mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 10:18:40 +00:00
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
This commit is contained in:
1 parent
4bb5e326db
commit
ac78d25240
10 files changed
+31
-16
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
public
|
||||||
@@ -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!
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
baseurl = ""
|
||||||
|
|
||||||
|
[indexes]
|
||||||
|
tag = "tags"
|
||||||
|
group = "groups"
|
||||||
|
menu = "menu"
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
indexes:
|
|
||||||
tag: 'tags'
|
|
||||||
group: 'groups'
|
|
||||||
menu: 'menu'
|
|
||||||
baseurl: ''
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{{ template "chrome/head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
{{ template "chrome/header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
{{ .Content }}
|
{{ if .IsPage }}{{ .Content }}{{ end }}
|
||||||
{{ template "chrome/footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
File renamed without changes.
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ .Params.lang }}">
|
<html lang="{{ .Params.lang }}">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
|||||||
{{ template "chrome/head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
{{ template "chrome/header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
{{ range .Site.Indexes.groups.news.Pages }}
|
{{ range .Site.Indexes.groups.news.Pages }}
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<header>
|
<header>
|
||||||
@@ -12,4 +12,4 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ template "chrome/footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{{ template "chrome/head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
{{ template "chrome/header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
{{ range .Site.Indexes.groups.uudised.Pages }}
|
{{ range .Site.Indexes.groups.uudised.Pages }}
|
||||||
<article class="post">
|
<article class="post">
|
||||||
<header>
|
<header>
|
||||||
@@ -12,4 +12,4 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ template "chrome/footer.html" . }}
|
{{ partial "footer.html" . }}
|
||||||
Reference in new issue
Block a user