diff options
author | Anthony Fok <foka@debian.org> | 2014-09-02 18:10:19 -0600 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-09-08 11:38:12 -0400 |
commit | ac78d25240b0aa428c5a46314b0a6a4e0621d69b (patch) | |
tree | 3473a0a7dafe240a110fb2a03e50267fb5971e4d /examples/multilingual/layouts | |
parent | 4bb5e326dbf0f732dd5db45a47fa25999806111e (diff) |
A small fix and update to the multilingual example
Enclose `{{ .Content }}` with a `{{ if .IsPage }}` test to avoid
the "Content is not a field of struct type *hugolib.Node" error.
Thanks to @spf13 for the tip! Fixes #366.
Also update example to Hugo v0.12 conventions:
- Convert config.yaml to config.toml to follow what
`hugo new site /path/to/site` generates
- Rename layouts/chrome to layouts/partials
- Convert `template` calls to `partial` calls
- Add .gitignore to ignore the `public` directory
- Add README.md with pointers to discussions in issues
to help bring newcomers up to speed with this multilingual example
Diffstat (limited to 'examples/multilingual/layouts')
-rw-r--r-- | examples/multilingual/layouts/_default/single.html | 8 | ||||
-rw-r--r-- | examples/multilingual/layouts/partials/footer.html (renamed from examples/multilingual/layouts/chrome/footer.html) | 0 | ||||
-rw-r--r-- | examples/multilingual/layouts/partials/head.html (renamed from examples/multilingual/layouts/chrome/head.html) | 2 | ||||
-rw-r--r-- | examples/multilingual/layouts/partials/header.html (renamed from examples/multilingual/layouts/chrome/header.html) | 4 | ||||
-rw-r--r-- | examples/multilingual/layouts/story/list.html | 6 | ||||
-rw-r--r-- | examples/multilingual/layouts/uudis/list.html | 6 |
6 files changed, 13 insertions, 13 deletions
diff --git a/examples/multilingual/layouts/_default/single.html b/examples/multilingual/layouts/_default/single.html index da3640efe..66e4a3828 100644 --- a/examples/multilingual/layouts/_default/single.html +++ b/examples/multilingual/layouts/_default/single.html @@ -1,4 +1,4 @@ -{{ template "chrome/head.html" . }}
-{{ template "chrome/header.html" . }}
-{{ .Content }}
-{{ template "chrome/footer.html" . }}
\ No newline at end of file +{{ partial "head.html" . }}
+{{ partial "header.html" . }}
+{{ if .IsPage }}{{ .Content }}{{ end }}
+{{ partial "footer.html" . }}
diff --git a/examples/multilingual/layouts/chrome/footer.html b/examples/multilingual/layouts/partials/footer.html index 2630b2e32..2630b2e32 100644 --- a/examples/multilingual/layouts/chrome/footer.html +++ b/examples/multilingual/layouts/partials/footer.html diff --git a/examples/multilingual/layouts/chrome/head.html b/examples/multilingual/layouts/partials/head.html index 44d1d7362..f89e3ffb3 100644 --- a/examples/multilingual/layouts/chrome/head.html +++ b/examples/multilingual/layouts/partials/head.html @@ -1,4 +1,4 @@ -<!doctype html>
+<!DOCTYPE html>
<html lang="{{ .Params.lang }}">
<head>
<meta charset="utf-8">
diff --git a/examples/multilingual/layouts/chrome/header.html b/examples/multilingual/layouts/partials/header.html index b99b2fbef..a244b8b0c 100644 --- a/examples/multilingual/layouts/chrome/header.html +++ b/examples/multilingual/layouts/partials/header.html @@ -12,7 +12,7 @@ {{ else }}
<h1 class="title">My multilingual site</h1>
{{ end }}
-
+
<nav class="menu main-menu">
<ul>
{{ range (index .Site.Indexes.menu .Params.lang).Pages }}
@@ -22,4 +22,4 @@ </nav>
</header>
-<h2 class="subtitle">{{ .Title }}</h2>
\ No newline at end of file +<h2 class="subtitle">{{ .Title }}</h2>
diff --git a/examples/multilingual/layouts/story/list.html b/examples/multilingual/layouts/story/list.html index 0173244f7..a753577d5 100644 --- a/examples/multilingual/layouts/story/list.html +++ b/examples/multilingual/layouts/story/list.html @@ -1,5 +1,5 @@ -{{ template "chrome/head.html" . }}
-{{ template "chrome/header.html" . }}
+{{ partial "head.html" . }}
+{{ partial "header.html" . }}
{{ range .Site.Indexes.groups.news.Pages }}
<article class="post">
<header>
@@ -12,4 +12,4 @@ </footer>
</article>
{{ end }}
-{{ template "chrome/footer.html" . }}
\ No newline at end of file +{{ partial "footer.html" . }}
diff --git a/examples/multilingual/layouts/uudis/list.html b/examples/multilingual/layouts/uudis/list.html index 970a48bfb..23c0daec8 100644 --- a/examples/multilingual/layouts/uudis/list.html +++ b/examples/multilingual/layouts/uudis/list.html @@ -1,5 +1,5 @@ -{{ template "chrome/head.html" . }}
-{{ template "chrome/header.html" . }}
+{{ partial "head.html" . }}
+{{ partial "header.html" . }}
{{ range .Site.Indexes.groups.uudised.Pages }}
<article class="post">
<header>
@@ -12,4 +12,4 @@ </footer>
</article>
{{ end }}
-{{ template "chrome/footer.html" . }}
\ No newline at end of file +{{ partial "footer.html" . }}
|