hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit ac78d25240b0aa428c5a46314b0a6a4e0621d69b
parent 4bb5e326dbf0f732dd5db45a47fa25999806111e
Author: Anthony Fok <foka@debian.org>
Date:   Tue,  2 Sep 2014 18:10:19 -0600

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:
Aexamples/multilingual/.gitignore | 1+
Aexamples/multilingual/README.md | 13+++++++++++++
Aexamples/multilingual/config.toml | 6++++++
Dexamples/multilingual/config.yaml | 5-----
Mexamples/multilingual/layouts/_default/single.html | 9++++-----
Dexamples/multilingual/layouts/chrome/head.html | 16----------------
Dexamples/multilingual/layouts/chrome/header.html | 26--------------------------
Rexamples/multilingual/layouts/chrome/footer.html -> examples/multilingual/layouts/partials/footer.html | 0
Aexamples/multilingual/layouts/partials/head.html | 16++++++++++++++++
Aexamples/multilingual/layouts/partials/header.html | 25+++++++++++++++++++++++++
Mexamples/multilingual/layouts/story/list.html | 7+++----
Mexamples/multilingual/layouts/uudis/list.html | 7+++----
12 files changed, 71 insertions(+), 60 deletions(-)
diff --git a/examples/multilingual/.gitignore b/examples/multilingual/.gitignore
@@ -0,0 +1 @@
+public
diff --git a/examples/multilingual/README.md 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
@@ -0,0 +1,6 @@
+baseurl = ""
+
+[indexes]
+tag = "tags"
+group = "groups"
+menu = "menu"
diff --git a/examples/multilingual/config.yaml b/examples/multilingual/config.yaml
@@ -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
@@ -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/head.html b/examples/multilingual/layouts/chrome/head.html
@@ -1,15 +0,0 @@
-<!doctype html>
-<html lang="{{ .Params.lang }}">
-<head>
-	<meta charset="utf-8">
-	{{ if .Title }}
-		{{ if (eq .Params.lang "et") }}
-		<title>Mitmekeelne - {{ .Title }}</title>
-		{{ else }}
-		<title>Multilingual - {{ .Title }}</title>
-		{{ end }}
-	{{ end }}
-	<meta name="viewport" content="width=device-width, initial-scale=1">
-	<link rel="stylesheet" href="/static/main.css">
-</head>
-<body>-
\ No newline at end of file
diff --git a/examples/multilingual/layouts/chrome/header.html b/examples/multilingual/layouts/chrome/header.html
@@ -1,25 +0,0 @@
-<header>
-	<nav class="menu language-menu">
-		<ul>
-			<li><a href="/">English</a></li>
-			<li><a href="/kodu">Eesti</a></li>
-		</ul>
-		<div class="clear"></div>
-	</nav>
-
-	{{ if (eq .Params.lang "et") }}
-	<h1 class="title">Minu mitmekeelne leht</h1>
-	{{ else }}
-	<h1 class="title">My multilingual site</h1>
-	{{ end }}
-	
-	<nav class="menu main-menu">
-		<ul>
-			{{ range (index .Site.Indexes.menu .Params.lang).Pages }}
-			<li><a href="{{ .Permalink  }}">{{ .LinkTitle }}</a></li>
-			{{ end }}
-		</ul>
-	</nav>
-</header>
-
-<h2 class="subtitle">{{ .Title }}</h2>-
\ No newline at end of file
diff --git a/examples/multilingual/layouts/chrome/footer.html b/examples/multilingual/layouts/partials/footer.html
diff --git a/examples/multilingual/layouts/partials/head.html b/examples/multilingual/layouts/partials/head.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="{{ .Params.lang }}">
+<head>
+	<meta charset="utf-8">
+	{{ if .Title }}
+		{{ if (eq .Params.lang "et") }}
+		<title>Mitmekeelne - {{ .Title }}</title>
+		{{ else }}
+		<title>Multilingual - {{ .Title }}</title>
+		{{ end }}
+	{{ end }}
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/static/main.css">
+</head>
+<body>+
\ No newline at end of file
diff --git a/examples/multilingual/layouts/partials/header.html b/examples/multilingual/layouts/partials/header.html
@@ -0,0 +1,25 @@
+<header>
+	<nav class="menu language-menu">
+		<ul>
+			<li><a href="/">English</a></li>
+			<li><a href="/kodu">Eesti</a></li>
+		</ul>
+		<div class="clear"></div>
+	</nav>
+
+	{{ if (eq .Params.lang "et") }}
+	<h1 class="title">Minu mitmekeelne leht</h1>
+	{{ else }}
+	<h1 class="title">My multilingual site</h1>
+	{{ end }}
+
+	<nav class="menu main-menu">
+		<ul>
+			{{ range (index .Site.Indexes.menu .Params.lang).Pages }}
+			<li><a href="{{ .Permalink  }}">{{ .LinkTitle }}</a></li>
+			{{ end }}
+		</ul>
+	</nav>
+</header>
+
+<h2 class="subtitle">{{ .Title }}</h2>
diff --git 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
@@ -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" . }}