summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorAnthony Fok <[email protected]>2014-09-02 18:10:19 -0600
committerspf13 <[email protected]>2014-09-08 11:38:12 -0400
commitac78d25240b0aa428c5a46314b0a6a4e0621d69b (patch)
tree3473a0a7dafe240a110fb2a03e50267fb5971e4d /examples
parent4bb5e326dbf0f732dd5db45a47fa25999806111e (diff)
downloadhugo-ac78d25240b0aa428c5a46314b0a6a4e0621d69b.tar.gz
hugo-ac78d25240b0aa428c5a46314b0a6a4e0621d69b.zip
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')
-rw-r--r--examples/multilingual/.gitignore1
-rw-r--r--examples/multilingual/README.md13
-rw-r--r--examples/multilingual/config.toml6
-rw-r--r--examples/multilingual/config.yaml5
-rw-r--r--examples/multilingual/layouts/_default/single.html8
-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.html6
-rw-r--r--examples/multilingual/layouts/uudis/list.html6
10 files changed, 33 insertions, 18 deletions
diff --git a/examples/multilingual/.gitignore b/examples/multilingual/.gitignore
new file mode 100644
index 000000000..a48cf0de7
--- /dev/null
+++ b/examples/multilingual/.gitignore
@@ -0,0 +1 @@
+public
diff --git a/examples/multilingual/README.md b/examples/multilingual/README.md
new file mode 100644
index 000000000..5e4b4ff3d
--- /dev/null
+++ b/examples/multilingual/README.md
@@ -0,0 +1,13 @@
+# Multilingual website with Hugo
+
+This example was kindly contributed by Egon Elbre in November 2013
+as a wonderful proof-of-concept for internationalization (i18n)
+and multilingualization (m17n) in Hugo-generated websites.
+
+The example works well for the most part, though some minor issues remain.
+Please see relevant discussions below:
+
+* https://github.com/spf13/hugo/issues/129 Multiple languages
+* https://github.com/spf13/hugo/issues/134 Example of a multilingual site
+
+All contributions are welcome!
diff --git a/examples/multilingual/config.toml b/examples/multilingual/config.toml
new file mode 100644
index 000000000..094b09b29
--- /dev/null
+++ b/examples/multilingual/config.toml
@@ -0,0 +1,6 @@
+baseurl = ""
+
+[indexes]
+tag = "tags"
+group = "groups"
+menu = "menu"
diff --git a/examples/multilingual/config.yaml b/examples/multilingual/config.yaml
deleted file mode 100644
index 017a9b59e..000000000
--- a/examples/multilingual/config.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-indexes:
- tag: 'tags'
- group: 'groups'
- menu: 'menu'
-baseurl: ''
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" . }}