From: Bjørn Erik Pedersen Date: Wed, 8 Aug 2018 11:54:42 +0000 (+0200) Subject: Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07' X-Git-Tag: v0.47~30 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1639fd20d8429806462c0bcc6ee2c47a30cf51f2;p=brevno-suite%2Fhugo Merge commit '3a44bf182fed5f34621f450114083a6dd7e88a07' --- 1639fd20d8429806462c0bcc6ee2c47a30cf51f2 diff --cc docs/alias.txt index 00000000,00000000..11733bee new file mode 100644 --- /dev/null +++ b/docs/alias.txt @@@ -1,0 -1,0 +1,239 @@@ ++content/en/tools/frontends.md:aliases: [] ++content/en/tools/search.md:aliases: [] ++content/en/tools/migrations.md:aliases: [/developer-tools/migrations/,/developer-tools/migrated/] ++content/en/tools/editors.md:aliases: [] ++content/en/tools/starter-kits.md:aliases: [/developer-tools/migrations/,/developer-tools/migrated/] ++content/en/tools/other.md:aliases: [] ++content/en/tools/_index.md:aliases: [/tools/] ++content/en/about/license.md:aliases: [/meta/license] ++content/en/about/benefits.md:aliases: [] ++content/en/about/hugo-and-gdpr.md:aliases: [/privacy/,/gdpr/] ++content/en/about/features.md:* Redirects via [aliases][] ++content/en/about/features.md:[aliases]: /content-management/urls/#aliases ++content/en/about/what-is-hugo.md:aliases: [/overview/introduction/,/about/why-i-built-hugo/] ++content/en/about/new-in-032/index.md:aliases: [] ++content/en/about/_index.md:aliases: [/about-hugo/,/docs/] ++content/en/troubleshooting/build-performance.md:aliases: [] ++content/en/troubleshooting/faq.md:aliases: [/faq/] ++content/en/troubleshooting/_index.md:aliases: [/troubleshooting/faqs/,/faqs/] ++content/en/hosting-and-deployment/hosting-on-firebase.md:aliases: [] ++content/en/hosting-and-deployment/hosting-on-github.md:aliases: [/tutorials/github-pages-blog/] ++content/en/hosting-and-deployment/hosting-on-netlify.md:aliases: [] ++content/en/hosting-and-deployment/deployment-with-nanobox.md:aliases: [/tutorials/deployment-with-nanobox/] ++content/en/hosting-and-deployment/deployment-with-wercker.md:aliases: [/tutorials/automated-deployments/] ++content/en/hosting-and-deployment/deployment-with-rsync.md:aliases: [/tutorials/deployment-with-rsync/] ++content/en/hosting-and-deployment/hosting-on-keycdn.md:aliases: [] ++content/en/hosting-and-deployment/hosting-on-gitlab.md:aliases: [/tutorials/hosting-on-gitlab/] ++content/en/hosting-and-deployment/_index.md:aliases: [] ++content/en/hosting-and-deployment/hosting-on-bitbucket.md:aliases: [/tutorials/hosting-on-bitbucket/] ++content/en/hugo-pipes/introduction.md:aliases: [/assets/] ++content/en/hugo-pipes/introduction.md:### Method aliases ++content/en/hugo-pipes/introduction.md:Non-transformation methods deprived of such aliases are `resources.Get`, `resources.FromString`, `resources.ExecuteAsTemplate` and `resources.Concat`. ++content/en/getting-started/directory-structure.md:aliases: [/overview/source-directory/] ++content/en/getting-started/usage.md:aliases: [/overview/usage/,/extras/livereload/,/doc/usage/,/usage/] ++content/en/getting-started/quick-start.md:aliases: [/quickstart/,/overview/quickstart/] ++content/en/getting-started/installing.md:aliases: [/tutorials/installing-on-windows/,/tutorials/installing-on-mac/,/overview/installing/,/getting-started/install,/install/] ++content/en/getting-started/configuration.md:aliases: [/overview/source-directory/,/overview/configuration/] ++content/en/getting-started/configuration.md:In the list to the right, values starting with ":" are date handlers with a special meaning (see below). The others are just names of date parameters (case insensitive) in your front matter configuration. Also note that Hugo have some built-in aliases to the above: `lastmod` => `modified`, `publishDate` => `pubdate`, `published` and `expiryDate` => `unpublishdate`. With that, as an example, using `pubDate` as a date in front matter, will, by default, be assigned to `.PublishDate`. ++content/en/getting-started/_index.md:aliases: [/overview/introduction/] ++content/en/news/0.18-relnotes/index.md:aliases: [/0-18/] ++content/en/news/0.19-relnotes/index.md:aliases: [/0-19/] ++content/en/news/0.20.3-relnotes/index.md:aliases: [/0-20-3/] ++content/en/news/0.20.2-relnotes/index.md:aliases: [/0-20-2/] ++content/en/news/0.24.1-relnotes/index.md:aliases: [/0-24-1/] ++content/en/news/0.20.4-relnotes/index.md:aliases: [/0-20-4/] ++content/en/news/0.20.5-relnotes/index.md:aliases: [/0-20-5/] ++content/en/news/0.21-relnotes/index.md:aliases: [/0-21/] ++content/en/news/0.20-relnotes/index.md:aliases: [/0-20/] ++content/en/news/0.25.1-relnotes/index.md:aliases: [/0-25-1/] ++content/en/news/0.10-relnotes/index.md:- Support for unicode URLs, aliases and indexes ++content/en/news/http2-server-push-in-hugo.md:aliases: [] ++content/en/news/http2-server-push-in-hugo.md:The template above creates 301 redirects for your [aliases](/content-management/urls/#aliases), so you will probably want to turn off aliases in your `config.toml`: `disableAliases = true`. ++content/en/news/0.20.1-relnotes/index.md:aliases: [/0-20-1/] ++content/en/news/0.25-relnotes/index.md:aliases: [/0-25/] ++content/en/news/0.24-relnotes/index.md:aliases: [/0-24/] ++content/en/news/0.16-relnotes/index.md:aliases: [/0-16/] ++content/en/news/0.17-relnotes/index.md:aliases: [/0-17/] ++content/en/news/0.20.7-relnotes/index.md:aliases: [/0-20-7/] ++content/en/news/0.20.6-relnotes/index.md:aliases: [/0-20-6/] ++content/en/news/0.22-relnotes/index.md:aliases: [/0-22/] ++content/en/news/0.22-relnotes/index.md:* Add `noindex` tag to HTML generated by Hugo aliases [d5ab7f08](https://github.com/gohugoio/hugo/commit/d5ab7f087d967b30e7de7d789e6ad3091b42f1f7) [@onedrawingperday](https://github.com/onedrawingperday) ++content/en/news/0.23-relnotes/index.md:aliases: [/0-23/] ++content/en/news/0.22.1-relnotes/index.md:aliases: [/0-22-1/] ++content/en/news/_index.md:aliases: [/release-notes/] ++content/en/variables/taxonomy.md:aliases: [] ++content/en/variables/site.md:aliases: [/variables/site-variables/] ++content/en/variables/menus.md:aliases: [/variables/menu/] ++content/en/variables/git.md:aliases: [/extras/gitinfo/] ++content/en/variables/files.md:aliases: [/variables/file-variables/] ++content/en/variables/page.md:aliases: [] ++content/en/variables/shortcodes.md:aliases: [] ++content/en/variables/sitemap.md:aliases: [] ++content/en/variables/_index.md:aliases: [/templates/variables/] ++content/en/variables/hugo.md:aliases: [] ++content/en/contribute/themes.md:aliases: [/contribute/theme/] ++content/en/contribute/documentation.md:aliases: [/contribute/docs/] ++content/en/contribute/development.md:aliases: [/contribute/development/] ++content/en/contribute/development.md:Now we'll create an [alias in Bash](http://tldp.org/LDP/abs/html/aliases.html) so that typing `git` actually runs `Hub`: ++content/en/contribute/_index.md:aliases: [/tutorials/how-to-contribute-to-hugo/,/community/contributing/] ++content/en/documentation.md:aliases: [] ++content/en/functions/countrunes.md:aliases: [/functions/countrunes/] ++content/en/functions/ref.md:aliases: [] ++content/en/functions/safeHTMLAttr.md:aliases: [] ++content/en/functions/echoparam.md:aliases: [] ++content/en/functions/urls.Parse.md:aliases: [] ++content/en/functions/ismenucurrent.md:aliases: [] ++content/en/functions/last.md:aliases: [] ++content/en/functions/countwords.md:aliases: [/functions/countwords/] ++content/en/functions/i18n.md:aliases: [] ++content/en/functions/pluralize.md:aliases: [] ++content/en/functions/htmlEscape.md:aliases: [] ++content/en/functions/default.md:aliases: [] ++content/en/functions/lower.md:aliases: [] ++content/en/functions/lang.Merge.md:aliases: [] ++content/en/functions/intersect.md:aliases: [] ++content/en/functions/jsonify.md:aliases: [] ++content/en/functions/lt.md:aliases: [] ++content/en/functions/shuffle.md:aliases: [] ++content/en/functions/replacere.md:aliases: [] ++content/en/functions/uniq.md:aliases: [] ++content/en/functions/sha.md:aliases: [] ++content/en/functions/split.md:aliases: [] ++content/en/functions/getenv.md:aliases: [] ++content/en/functions/first.md:aliases: [] ++content/en/functions/strings.TrimRight.md:aliases: [] ++content/en/functions/hasmenucurrent.md:aliases: [] ++content/en/functions/querify.md:aliases: [] ++content/en/functions/strings.TrimSuffix.md:aliases: [] ++content/en/functions/get.md:aliases: [] ++content/en/functions/int.md:aliases: [] ++content/en/functions/slicestr.md:aliases: [] ++content/en/functions/singularize.md:aliases: [] ++content/en/functions/strings.RuneCount.md:aliases: [] ++content/en/functions/replace.md:aliases: [] ++content/en/functions/haschildren.md:aliases: [] ++content/en/functions/title.md:aliases: [] ++content/en/functions/seq.md:aliases: [] ++content/en/functions/union.md:aliases: [] ++content/en/functions/md5.md:aliases: [] ++content/en/functions/apply.md:aliases: [] ++content/en/functions/GetPage.md:aliases: [] ++content/en/functions/ge.md:aliases: [] ++content/en/functions/readfile.md:aliases: [] ++content/en/functions/index-function.md:aliases: [/functions/index/] ++content/en/functions/string.md:aliases: [] ++content/en/functions/dict.md:aliases: [] ++content/en/functions/math.md:aliases: [] ++content/en/functions/NumFmt.md:aliases: [] ++content/en/functions/readdir.md:aliases: [] ++content/en/functions/hasPrefix.md:aliases: [] ++content/en/functions/le.md:aliases: [] ++content/en/functions/safeURL.md:aliases: [] ++content/en/functions/absurl.md:aliases: [] ++content/en/functions/base64.md:aliases: [] ++content/en/functions/unix.md:aliases: [] ++content/en/functions/safeCSS.md:aliases: [] ++content/en/functions/render.md:aliases: [] ++content/en/functions/abslangurl.md:aliases: [] ++content/en/functions/partialCached.md:aliases: [] ++content/en/functions/strings.TrimPrefix.md:aliases: [] ++content/en/functions/slice.md:aliases: [] ++content/en/functions/ne.md:aliases: [] ++content/en/functions/time.md:aliases: [] ++content/en/functions/strings.TrimLeft.md:aliases: [] ++content/en/functions/delimit.md:aliases: [] ++content/en/functions/relLangURL.md:aliases: [] ++content/en/functions/in.md:aliases: [] ++content/en/functions/format.md:aliases: [] ++content/en/functions/param.md:aliases: [] ++content/en/functions/now.md:aliases: [] ++content/en/functions/findRe.md:aliases: [] ++content/en/functions/eq.md:aliases: [] ++content/en/functions/errorf.md:aliases: [] ++content/en/functions/relurl.md:aliases: [] ++content/en/functions/after.md:aliases: [] ++content/en/functions/scratch.md:aliases: [/extras/scratch/,/doc/scratch/] ++content/en/functions/substr.md:aliases: [] ++content/en/functions/plainify.md:aliases: [] ++content/en/functions/humanize.md:aliases: [] ++content/en/functions/adddate.md:aliases: [] ++content/en/functions/fileExists.md:aliases: [] ++content/en/functions/upper.md:aliases: [] ++content/en/functions/sort.md:aliases: [] ++content/en/functions/len.md:aliases: [] ++content/en/functions/safeJS.md:aliases: [] ++content/en/functions/htmlUnescape.md:aliases: [] ++content/en/functions/float.md:aliases: [] ++content/en/functions/markdownify.md:aliases: [] ++content/en/functions/_index.md:aliases: [/layout/functions/,/templates/functions] ++content/en/functions/gt.md:aliases: [] ++content/en/functions/range.md:aliases: [] ++content/en/functions/relref.md:aliases: [] ++content/en/functions/isset.md:aliases: [] ++content/en/content-management/organization/index.md:aliases: [/content/sections/] ++content/en/content-management/formats.md:aliases: [/content/markdown-extras/,/content/supported-formats/,/doc/supported-formats/,/tutorials/mathjax/] ++content/en/content-management/authors.md:aliases: [/content/archetypes/] ++content/en/content-management/front-matter.md:aliases: [/content/front-matter/] ++content/en/content-management/front-matter.md:aliases ++content/en/content-management/front-matter.md:: an array of one or more aliases (e.g., old published paths of renamed content) that will be created in the output directory structure . See [Aliases][aliases] for details. ++content/en/content-management/front-matter.md:[aliases]: /content-management/urls/#aliases/ ++content/en/content-management/taxonomies.md:aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes] ++content/en/content-management/static-files.md:aliases: [/static-files] ++content/en/content-management/summaries.md:aliases: [/content/summaries/,/content-management/content-summaries/] ++content/en/content-management/comments.md:aliases: [/extras/comments/] ++content/en/content-management/menus.md:aliases: [/extras/menus/] ++content/en/content-management/urls.md:description: Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs. ++content/en/content-management/urls.md:keywords: [aliases,redirects,permalinks,urls] ++content/en/content-management/urls.md:aliases: [/extras/permalinks/,/extras/aliases/,/extras/urls/,/doc/redirects/,/doc/alias/,/doc/aliases/] ++content/en/content-management/urls.md:Luckily, redirects can be handled easily with **aliases** in Hugo. ++content/en/content-management/urls.md:Let's assume you create a new piece of content at `content/posts/my-awesome-blog-post.md`. The content is a revision of your previous post at `content/posts/my-original-url.md`. You can create an `aliases` field in the front matter of your new `my-awesome-blog-post.md` where you can add previous paths. The following examples show how to create this field in TOML and YAML front matter, respectively. ++content/en/content-management/urls.md:aliases = [ ++content/en/content-management/urls.md:aliases: ++content/en/content-management/urls.md:Now when you visit any of the locations specified in aliases---i.e., *assuming the same site domain*---you'll be redirected to the page they are specified on. For example, a visitor to `example.com/posts/my-original-url/` will be immediately redirected to `example.com/posts/my-awesome-post/`. ++content/en/content-management/urls.md:On [multilingual sites][multilingual], each translation of a post can have unique aliases. To use the same alias across multiple languages, prefix it with the language code. ++content/en/content-management/urls.md:aliases: ++content/en/content-management/urls.md:When aliases are specified, Hugo creates a directory to match the alias entry. Inside the directory, Hugo creates an `.html` file specifying the canonical URL for the page and the new redirect target. ++content/en/content-management/urls.md:aliases: [/posts/my-old-url/] ++content/en/content-management/urls.md:1. Hugo makes no assumptions about aliases. They also do not change based ++content/en/content-management/sections.md:aliases: [/content/sections/] ++content/en/content-management/related.md:aliases: [/content/related/,/related/] ++content/en/content-management/archetypes.md:aliases: [/content/archetypes/] ++content/en/content-management/toc.md:aliases: [/extras/toc/] ++content/en/content-management/cross-references.md:aliases: [/extras/crossreferences/] ++content/en/content-management/multilingual.md:aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/] ++content/en/content-management/shortcodes.md:aliases: [/extras/shortcodes/] ++content/en/content-management/types.md:aliases: [/content/types] ++content/en/content-management/syntax-highlighting.md:aliases: [/extras/highlighting/,/extras/highlight/,/tools/syntax-highlighting/] ++content/en/content-management/syntax-highlighting.md:The full list of Chroma lexers and their aliases (which is the identifier used in the `hightlight` template func or when doing highlighting in code fences): ++content/en/content-management/_index.md:aliases: [/content/,/content/organization] ++content/en/templates/taxonomy-templates.md:aliases: [/taxonomies/displaying/,/templates/terms/,/indexes/displaying/,/taxonomies/templates/,/indexes/ordering/, /templates/taxonomies/, /templates/taxonomy/] ++content/en/templates/sitemap-template.md:aliases: [/layout/sitemap/,/templates/sitemap/] ++content/en/templates/lookup-order.md:aliases: [/templates/lookup/] ++content/en/templates/base.md:aliases: [/templates/blocks/,/templates/base-templates-and-blocks/] ++content/en/templates/alternatives.md:aliases: [/templates/ace/,/templates/amber/] ++content/en/templates/views.md:aliases: [] ++content/en/templates/shortcode-templates.md:aliases: [] ++content/en/templates/robots.md:aliases: [/extras/robots-txt/] ++content/en/templates/section-templates.md:aliases: [/templates/sections/] ++content/en/templates/pagination.md:aliases: [/extras/pagination,/doc/pagination/] ++content/en/templates/homepage.md:aliases: [/layout/homepage/,/templates/homepage-template/] ++content/en/templates/introduction.md:aliases: [/layouts/introduction/,/layout/introduction/, /templates/go-templates/] ++content/en/templates/template-debugging.md:aliases: [] ++content/en/templates/menu-templates.md:aliases: [/templates/menus/] ++content/en/templates/lists.md:aliases: [/templates/list/,/layout/indexes/] ++content/en/templates/ordering-and-grouping.md:aliases: [/templates/ordering/,/templates/grouping/] ++content/en/templates/partials.md:aliases: [/templates/partial/,/layout/chrome/,/extras/analytics/] ++content/en/templates/data-templates.md:aliases: [/extras/datafiles/,/extras/datadrivencontent/,/doc/datafiles/] ++content/en/templates/single-page-templates.md:aliases: [/layout/content/] ++content/en/templates/404.md:aliases: [] ++content/en/templates/files.md:aliases: [/extras/localfiles/,/templates/local-files/] ++content/en/templates/internal.md:aliases: [] ++content/en/templates/output-formats.md:aliases: [/templates/outputs/,/extras/output-formats/,/content-management/custom-outputs/] ++content/en/templates/output-formats.md:: used in situations only relevant for `HTML`-type formats; e.g., page aliases. ++content/en/templates/_index.md:aliases: [/templates/overview/,/templates/content] ++content/en/maintenance/_index.md:aliases: [] ++content/en/showcase/1password-support/index.md:aliases: [/showcase/1password/] ++content/en/themes/creating.md:aliases: [/themes/creation/,/tutorials/creating-a-new-theme/] ++content/en/themes/theme-components.md:aliases: [/themes/customize/,/themes/customizing/] ++content/en/themes/installing-and-using-themes.md:aliases: [/themes/usage/,/themes/installing/] ++content/en/themes/_index.md:aliases: [/themes/overview/] diff --cc docs/content/en/about/features.md index e6ab6eea,00000000..4176c60d mode 100644,000000..100644 --- a/docs/content/en/about/features.md +++ b/docs/content/en/about/features.md @@@ -1,88 -1,0 +1,87 @@@ +--- +title: Hugo Features +linktitle: Hugo Features +description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +menu: + docs: + parent: "about" + weight: 20 +weight: 20 +sections_weight: 20 +draft: false - aliases: [/about/features] +toc: true +--- + +## General + +* [Extremely fast][] build times (< 1 ms per page) +* Completely cross platform, with [easy installation][install] on macOS, Linux, Windows, and more +* Renders changes on the fly with [LiveReload][] as you develop +* [Powerful theming][] +* [Host your site anywhere][hostanywhere] + +## Organization + +* Straightforward [organization for your projects][], including website sections +* Customizable [URLs][] +* Support for configurable [taxonomies][], including categories and tags +* [Sort content][] as you desire through powerful template [functions][] +* Automatic [table of contents][] generation +* [Dynamic menu][] creation +* [Pretty URLs][] support +* [Permalink][] pattern support +* Redirects via [aliases][] + +## Content + +* Native Markdown and Emacs Org-Mode support, as well as other languages via *external helpers* (see [supported formats][]) +* TOML, YAML, and JSON metadata support in [front matter][] +* Customizable [homepage][] +* Multiple [content types][] +* Automatic and user defined [content summaries][] +* [Shortcodes][] to enable rich content inside of Markdown +* ["Minutes to Read"][pagevars] functionality +* ["Wordcount"][pagevars] functionality + +## Additional Features + +* Integrated [Disqus][] comment support +* Integrated [Google Analytics][] support +* Automatic [RSS][] creation +* Support for [Go][], [Amber], and [Ace][] HTML templates +* [Syntax highlighting][] powered by [Chroma][] (partly compatible with Pygments) + + +[Ace]: /templates/alternatives/ +[aliases]: /content-management/urls/#aliases +[Amber]: https://github.com/eknkc/amber +[Chroma]: https://github.com/alecthomas/chroma +[content summaries]: /content-management/summaries/ +[content types]: /content-management/types/ +[Disqus]: https://disqus.com/ +[Dynamic menu]: /templates/menus/ +[Extremely fast]: https://github.com/bep/hugo-benchmark +[front matter]: /content-management/front-matter/ +[functions]: /functions/ +[Go]: http://golang.org/pkg/html/template/ +[Google Analytics]: https://google-analytics.com/ +[homepage]: /templates/homepage/ +[hostanywhere]: /hosting-and-deployment/ +[install]: /getting-started/installing/ +[LiveReload]: /getting-started/usage/ +[organization for your projects]: /getting-started/directory-structure/ +[pagevars]: /variables/page/ +[Permalink]: /content-management/urls/#permalinks +[Powerful theming]: /themes/ +[Pretty URLs]: /content-management/urls/ +[RSS]: /templates/rss/ +[Shortcodes]: /content-management/shortcodes/ +[sort content]: /templates/ +[supported formats]: /content-management/formats/ +[Syntax highlighting]: /tools/syntax-highlighting/ +[table of contents]: /content-management/toc/ +[taxonomies]: /content-management/taxonomies/ +[URLs]: /content-management/urls/ diff --cc docs/content/en/content-management/multilingual.md index 32eeb779,00000000..fab9c17b mode 100644,000000..100644 --- a/docs/content/en/content-management/multilingual.md +++ b/docs/content/en/content-management/multilingual.md @@@ -1,460 -1,0 +1,460 @@@ +--- +title: Multilingual Mode +linktitle: Multilingual and i18n +description: Hugo supports the creation of websites with multiple languages side by side. +date: 2017-01-10 +publishdate: 2017-01-10 +lastmod: 2017-01-10 +categories: [content management] +keywords: [multilingual,i18n, internationalization] +menu: + docs: + parent: "content-management" + weight: 150 +weight: 150 #rem +draft: false - aliases: [/content/multilingual/,/content-management/multilingual/,/tutorials/create-a-multilingual-site/] ++aliases: [/content/multilingual/,/tutorials/create-a-multilingual-site/] +toc: true +--- + +You should define the available languages in a `languages` section in your site configuration. + +## Configure Languages + +The following is an example of a site configuration for a multilingual Hugo project: + +{{< code-toggle file="config" >}} +DefaultContentLanguage = "en" +copyright = "Everything is mine" + +[params.navigation] +help = "Help" + +[languages] +[languages.en] +title = "My blog" +weight = 1 +[languages.en.params] +linkedin = "https://linkedin.com/whoever" + +[languages.fr] +title = "Mon blogue" +weight = 2 +[languages.fr.params] +linkedin = "https://linkedin.com/fr/whoever" +[languages.fr.params.navigation] +help = "Aide" +{{< /code-toggle >}} + +Anything not defined in a `[languages]` block will fall back to the global +value for that key (e.g., `copyright` for the English [`en`] language). + +With the configuration above, all content, sitemap, RSS feeds, paginations, +and taxonomy pages will be rendered below `/` in English (your default content language) and then below `/fr` in French. + +When working with front matter `Params` in [single page templates][singles], omit the `params` in the key for the translation. + +`defaultContentLanguage` sets the project's default language. If not set, the default language will be `en`. + +If the default language needs to be rendererd below its own language code (`/en`) like the others, set `defaultContentLanguageInSubdir: true`. + +Only the obvious non-global options can be overridden per language. Examples of global options are `baseURL`, `buildDrafts`, etc. + +### Disable a Language + +You can disable one or more languages. This can be useful when working on a new translation. + +```toml +disableLanguages = ["fr", "jp"] +``` + +Note that you cannot disable the default content language. + +We kept this as a standalone setting to make it easier to set via [OS environment](/getting-started/configuration/#configure-with-environment-variables): + +```bash +HUGO_DISABLELANGUAGES="fr jp" hugo +``` +If you have already a list of disabled languages in `config.toml`, you can enable them in development like this: + +```bash +HUGO_DISABLELANGUAGES=" " hugo server +``` + + +### Configure Multilingual Multihost + +From **Hugo 0.31** we support multiple languages in a multihost configuration. See [this issue](https://github.com/gohugoio/hugo/issues/4027) for details. + +This means that you can now configure a `baseURL` per `language`: + + +> If a `baseURL` is set on the `language` level, then all languages must have one and they must all be different. + +Example: + +{{< code-toggle file="config" >}} +[languages] +[languages.fr] +baseURL = "https://example.fr" +languageName = "Français" +weight = 1 +title = "En Français" + +[languages.en] +baseURL = "https://example.com" +languageName = "English" +weight = 2 +title = "In English" +{{}} + +With the above, the two sites will be generated into `public` with their own root: + +```bash +public +├── en +└── no +``` + +**All URLs (i.e `.Permalink` etc.) will be generated from that root. So the English home page above will have its `.Permalink` set to `https://example.com/`.** + +When you run `hugo server` we will start multiple HTTP servers. You will typlically see something like this in the console: + +```bash +Web Server is available at 127.0.0.1:1313 (bind address 127.0.0.1) +Web Server is available at 127.0.0.1:1314 (bind address 127.0.0.1) +Press Ctrl+C to stop +``` + +Live reload and `--navigateToChanged` between the servers work as expected. + +### Taxonomies and Blackfriday + +Taxonomies and [Blackfriday configuration][config] can also be set per language: + + +{{< code-toggle file="config" >}} +[Taxonomies] +tag = "tags" + +[blackfriday] +angledQuotes = true +hrefTargetBlank = true + +[languages] +[languages.en] +weight = 1 +title = "English" +[languages.en.blackfriday] +angledQuotes = false + +[languages.fr] +weight = 2 +title = "Français" +[languages.fr.Taxonomies] +plaque = "plaques" +{{}} + +## Translate Your Content + +There are two ways to manage your content translation, both ensures each page is assigned a language and linked to its translations. + +### Translation by filename + +Considering the following example: + +1. `/content/about.en.md` +2. `/content/about.fr.md` + +The first file is assigned the english language and linked to the second. +The second file is assigned the french language and linked to the first. + +Their language is __assigned__ according to the language code added as __suffix to the filename__. + +By having the same **path and base filename**, the content pieces are __linked__ together as translated pages. +{{< note >}} + +If a file is missing any language code, it will be assigned the default language. + +{{}} +### Translation by content directory + +This system uses different content directories for each of the languages. Each language's content directory is set using the `contentDir` param. + +{{< code-toggle file="config" >}} + +languages: + en: + weight: 10 + languageName: "English" + contentDir: "content/english" + nn: + weight: 20 + languageName: "Français" + contentDir: "content/french" + +{{< /code-toggle >}} + +The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content directories cannot overlap. + +Considering the following example in conjunction with the configuration above: + +1. `/content/english/about.md` +2. `/content/french/about.md` + +The first file is assigned the english language and is linked to the second. +
The second file is assigned the french language and is linked to the first. + +Their language is __assigned__ according to the content directory they are __placed__ in. + +By having the same **path and basename** (relative to their language content directory), the content pieces are __linked__ together as translated pages. + +### Bypassing default linking. + +Any pages sharing the same `translationKey` set in front matter will be linked as translated pages regardless of basename or location. + +Considering the following example: + +1. `/content/about-us.en.md` +2. `/content/om.nn.md` +3. `/content/presentation/a-propos.fr.md` + +```yaml +# set in all three pages +translationKey: "about" +``` + +By setting the `translationKey` front matter param to `about` in all three pages, they will be __linked__ as translated pages. + + +### Localizing permalinks + +Because paths and filenames are used to handle linking, all translated pages, except for the language part, will be sharing the same url. + +To localize the URLs, the [`slug`]({{< ref "/content-management/organization/index.md#slug" >}}) or [`url`]({{< ref "/content-management/organization/index.md#url" >}}) front matter param can be set in any of the non-default language file. + +For example, a french translation (`content/about.fr.md`) can have its own localized slug. + +{{< code-toggle >}} +Title: A Propos +slug: "a-propos" +{{< /code-toggle >}} + + +At render, Hugo will build both `/about/` and `fr/a-propos/` while maintaning their translation linking. +{{% note %}} +If using `url`, remember to include the language part as well: `fr/compagnie/a-propos/`. +{{%/ note %}} + +### Page Bundles + +To avoid the burden of having to duplicate files, each Page Bundle inherits the resources of its linked translated pages' bundles except for the content files (markdown files, html files etc...). + +Therefore, from within a template, the page will have access to the files from all linked pages' bundles. + +If, across the linked bundles, two or more files share the same basenname, only one will be included and chosen as follows: + +* File from current language Bundle, if present. +* First file found across bundles by order of language `Weight`. + +{{% note %}} + +Page Bundle's resources follow the same language assignement logic as content files, be it by filename (`image.jpg`, `image.fr.jpg`) or by directory (`english/about/header.jpg`, `french/about/header.jpg`). + +{{%/ note %}} + +## Reference the Translated Content + +To create a list of links to translated content, use a template similar to the following: + +{{< code file="layouts/partials/i18nlist.html" >}} +{{ if .IsTranslated }} +

{{ i18n "translations" }}

+ +{{ end }} +{{< /code >}} + +The above can be put in a `partial` (i.e., inside `layouts/partials/`) and included in any template, be it for a [single content page][contenttemplate] or the [homepage][]. It will not print anything if there are no translations for a given page. + +The above also uses the [`i18n` function][i18func] described in the next section. + +### List All Available Languages + +`.AllTranslations` on a `Page` can be used to list all translations, including itself. Called on the home page it can be used to build a language navigator: + + +{{< code file="layouts/partials/allLanguages.html" >}} + +{{< /code >}} + +## Translation of Strings + +Hugo uses [go-i18n][] to support string translations. [See the project's source repository][go-i18n-source] to find tools that will help you manage your translation workflows. + +Translations are collected from the `themes//i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to [RFC 5646][] with names such as `en-US.toml`, `fr.toml`, etc. + +{{% note %}} +From **Hugo 0.31** you no longer need to use a valid language code. It _can be_ anything. + +See https://github.com/gohugoio/hugo/issues/3564 + +{{% /note %}} + +From within your templates, use the `i18n` function like this: + +``` +{{ i18n "home" }} +``` + +This uses a definition like this one in `i18n/en-US.toml`: + +``` +[home] +other = "Home" +``` + +Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`: + +``` +{{ i18n "wordCount" . }} +``` + +This uses a definition like this one in `i18n/en-US.toml`: + +``` +[wordCount] +other = "This article has {{ .WordCount }} words." +``` +An example of singular and plural form: + +``` +[readingTime] +one = "One minute read" +other = "{{.Count}} minutes read" +``` +And then in the template: + +``` +{{ i18n "readingTime" .ReadingTime }} +``` +To track down missing translation strings, run Hugo with the `--i18n-warnings` flag: + +``` + hugo --i18n-warnings | grep i18n +i18n|MISSING_TRANSLATION|en|wordCount +``` + +## Customize Dates + +At the time of this writing, Go does not yet have support for internationalized locales, but if you do some work, you can simulate it. For example, if you want to use French month names, you can add a data file like ``data/mois.yaml`` with this content: + +~~~yaml +1: "janvier" +2: "février" +3: "mars" +4: "avril" +5: "mai" +6: "juin" +7: "juillet" +8: "août" +9: "septembre" +10: "octobre" +11: "novembre" +12: "décembre" +~~~ + +... then index the non-English date names in your templates like so: + +~~~html + +~~~ + +This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file. + +## Menus + +You can define your menus for each language independently. The [creation of a menu][menus] works analogous to earlier versions of Hugo, except that they have to be defined in their language-specific block in the configuration file: + +``` +defaultContentLanguage = "en" + +[languages.en] +weight = 0 +languageName = "English" + +[[languages.en.menu.main]] +url = "/" +name = "Home" +weight = 0 + + +[languages.de] +weight = 10 +languageName = "Deutsch" + +[[languages.de.menu.main]] +url = "/" +name = "Startseite" +weight = 0 +``` + +The rendering of the main navigation works as usual. `.Site.Menus` will just contain the menu of the current language. Pay attention to the generation of the menu links. `absLangURL` takes care that you link to the correct locale of your website. Otherwise, both menu entries would link to the English version as the default content language that resides in the root directory. + +``` + + +``` + +## Missing Translations + +If a string does not have a translation for the current language, Hugo will use the value from the default language. If no default value is set, an empty string will be shown. + +While translating a Hugo website, it can be handy to have a visual indicator of missing translations. The [`enableMissingTranslationPlaceholders` configuration option][config] will flag all untranslated strings with the placeholder `[i18n] identifier`, where `identifier` is the id of the missing translation. + +{{% note %}} +Hugo will generate your website with these missing translation placeholders. It might not be suited for production environments. +{{% /note %}} + +For merging of content from other languages (i.e. missing content translations), see [lang.Merge](/functions/lang.merge/). + +## Multilingual Themes support + +To support Multilingual mode in your themes, some considerations must be taken for the URLs in the templates. If there is more than one language, URLs must meet the following criteria: + +* Come from the built-in `.Permalink` or `.RelPermalink` +* Be constructed with + * The [`relLangURL` template function][rellangurl] or the [`absLangURL` template function][abslangurl] **OR** + * Prefixed with `{{ .LanguagePrefix }}` + +If there is more than one language defined, the `LanguagePrefix` variable will equal `/en` (or whatever your `CurrentLanguage` is). If not enabled, it will be an empty string and is therefore harmless for single-language Hugo websites. + +[abslangurl]: /functions/abslangurl +[config]: /getting-started/configuration/ +[contenttemplate]: /templates/single-page-templates/ +[go-i18n-source]: https://github.com/nicksnyder/go-i18n +[go-i18n]: https://github.com/nicksnyder/go-i18n +[homepage]: /templates/homepage/ +[i18func]: /functions/i18n/ +[menus]: /content-management/menus/ +[rellangurl]: /functions/rellangurl +[RFC 5646]: https://tools.ietf.org/html/rfc5646 +[singles]: /templates/single-page-templates/ diff --cc docs/content/en/content-management/toc.md index 681416a7,00000000..a500bcf6 mode 100644,000000..100644 --- a/docs/content/en/content-management/toc.md +++ b/docs/content/en/content-management/toc.md @@@ -1,95 -1,0 +1,95 @@@ +--- +title: Table of Contents +linktitle: +description: Hugo can automatically parse Markdown content and create a Table of Contents you can use in your templates. +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [content management] +keywords: [table of contents, toc] +menu: + docs: + parent: "content-management" + weight: 130 +weight: 130 #rem +draft: false - aliases: [/extras/toc/,/content-management/toc/] ++aliases: [/extras/toc/] +toc: true +--- + +{{% note "TOC Heading Levels are Fixed" %}} +Currently, the `{{.TableOfContents}}` [page variable](/variables/page/) does not allow you to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `` is going to start at `

` when pulling from `{{.Content}}`. +{{% /note %}} + +## Usage + +Create your markdown the way you normally would with the appropriate headings. Here is some example content: + +``` + + +## Introduction + +One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. + +## My Heading + +He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. + +### My Subheading + +A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops +``` + +Hugo will take this Markdown and create a table of contents from `## Introduction`, `## My Heading`, and `### My Subheading` and then store it in the [page variable][pagevars]`.TableOfContents`. + +The built-in `.TableOfContents` variables outputs a `