Skip to content

Instantly share code, notes, and snippets.

@LeeU1911
Last active April 15, 2017 08:37
Show Gist options
  • Save LeeU1911/bc2a2464a15c817e9b0f0dd63ec8420c to your computer and use it in GitHub Desktop.
Save LeeU1911/bc2a2464a15c817e9b0f0dd63ec8420c to your computer and use it in GitHub Desktop.
Minimal multilingual code example - Hugo issue
# Site settings
baseurl = "https://example.com"
defaultContentLanguage = "vi"
########################################
#
## Vietnamese
[languages.vi]
title = "Xin chào"
weight = 0
[[languages.vi.menu.main]]
url = "/blog"
name = "Blog"
weight = 0
# Footer section
[languages.vi.params.footer]
enable = true
copyright = "Bản quyền (C) 2017"
[[languages.vi.params.footer.quicklinks]]
text = "Điều khoản sử dụng"
link = "/term-conditions"
[[languages.vi.params.footer.social]]
icon = "fa-facebook"
link = "https://www.facebook.com/"
########################################
#
## English
[languages.en]
title = "Welcome"
weight = 0
[[languages.en.menu.main]]
url = "/blogs"
name = "Blogs"
weight = 0
# Footer section
[languages.en.params.footer]
enable = true
copyright = "Copyright (C) 2017"
[[languages.en.params.footer.quicklinks]]
text = "Term and Conditions"
link = "/term-conditions"
[[languages.en.params.footer.social]]
icon = "fa-facebook"
link = "https://www.facebook.com/"
<!DOCTYPE html>
<html lang="{{ .Params.lang }}">
<body id="page-top" class="index">
<!-- Print out all Params values for debugging purpose -->
{{ printf "%#v" $.Site.Params }}
{{ if .Site.Params.footer.enable }}
{{ partial "footer.html" . }}
{{ end }}
@LeeU1911
Copy link
Author

LeeU1911 commented Apr 15, 2017

See solution in my comment here: gohugoio/hugo#3346 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment