hugo/hugolib
Bjørn Erik Pedersen eb42774e58
Add support for a content dir set per language
A sample config:

```toml
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true

[Languages]
[Languages.en]
weight = 10
title = "In English"
languageName = "English"
contentDir = "content/english"

[Languages.nn]
weight = 20
title = "På Norsk"
languageName = "Norsk"
contentDir = "content/norwegian"
```

The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content dirs cannot overlap.

The content files will be assigned a language by

1. The placement: `content/norwegian/post/my-post.md` will be read as Norwegian content.
2. The filename: `content/english/post/my-post.nn.md` will be read as Norwegian even if it lives in the English content folder.

The content directories will be merged into a big virtual filesystem with one simple rule: The most specific language file will win.
This means that if both `content/norwegian/post/my-post.md` and `content/english/post/my-post.nn.md` exists, they will be considered duplicates and the version inside `content/norwegian` will win.

Note that translations will be automatically assigned by Hugo by the content file's relative placement, so `content/norwegian/post/my-post.md` will be a translation of `content/english/post/my-post.md`.

If this does not work for you, you can connect the translations together by setting a `translationKey` in the content files' front matter.

Fixes #4523
Fixes #4552
Fixes #4553
2018-04-02 08:06:21 +02:00
..
pagemeta Refactor the GitInfo into the date handlers 2018-03-11 21:32:05 +01:00
testdata
testsite/content Refactor the GitInfo into the date handlers 2018-03-11 21:32:05 +01:00
404_test.go Spring test cleaning, take 2 2018-03-18 09:54:32 +01:00
alias.go
alias_test.go Spring test cleaning, take 2 2018-03-18 09:54:32 +01:00
author.go
case_insensitive_test.go Allow themes to define output formats, media types and params 2018-03-21 09:22:19 +01:00
config.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
config_test.go Allow themes to define output formats, media types and params 2018-03-21 09:22:19 +01:00
datafiles_test.go hugolib: Test cleaning #1 2018-03-17 18:59:07 +01:00
disableKinds_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
embedded_shortcodes_test.go Add "target" and "rel" parameters to figure shortcode 2018-02-09 22:27:58 +01:00
fileInfo.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
gitinfo.go Refactor the GitInfo into the date handlers 2018-03-11 21:32:05 +01:00
hugo_info.go Make ge, le etc. work with the Hugo Version number 2018-02-22 09:15:12 +01:00
hugo_info_test.go Make ge, le etc. work with the Hugo Version number 2018-02-22 09:15:12 +01:00
hugo_sites.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
hugo_sites_build.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
hugo_sites_build_failures_test.go hugolib: Fix freeze in invalid front matter error case 2018-03-24 10:06:58 +01:00
hugo_sites_build_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
hugo_sites_multihost_test.go Spring test cleaning, take 2 2018-03-18 09:54:32 +01:00
language_content_dir_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
media.go
menu.go hugolib: Remove unused code 2018-01-25 17:14:03 +01:00
menu_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
multilingual.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_bundler.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_bundler_capture.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_bundler_capture_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_bundler_handlers.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_bundler_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_collections.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_collections_test.go
page_output.go hugolib: Improve error message in .Render 2018-02-13 09:01:47 +01:00
page_paths.go hugolib: Extract date and slug from filename 2018-03-11 18:26:18 +01:00
page_paths_test.go
page_permalink_test.go
page_resource.go
page_taxonomy_test.go
page_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
page_time_integration_test.go
pageCache.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
pageCache_test.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
pageGroup.go
pageGroup_test.go
pages_language_merge.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
pages_language_merge_test.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
pages_related.go
pages_related_test.go
pageSort.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
pageSort_test.go
pagesPrevNext.go hugolib: Simplify Prev/Next 2018-03-12 22:13:25 +01:00
pagesPrevNext_test.go
pagination.go
pagination_test.go
path_separators_test.go
permalinker.go
permalinks.go
permalinks_test.go
prune_resources.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
robotstxt_test.go Spring test cleaning, take 2 2018-03-18 09:54:32 +01:00
rss_test.go
scratch.go hugolib: Add Reset method to delete key from Scratch 2018-03-17 00:13:23 +01:00
scratch_test.go hugolib: Add Reset method to delete key from Scratch 2018-03-17 00:13:23 +01:00
shortcode.go
shortcode_test.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
shortcodeparser.go
shortcodeparser_test.go
site.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
site_benchmark_test.go Add a GetPage to the site benchmarks 2018-01-24 09:08:26 +01:00
site_output.go Allow partial redefinition of the ouputs config 2018-03-10 16:57:25 +01:00
site_output_test.go Allow partial redefinition of the ouputs config 2018-03-10 16:57:25 +01:00
site_render.go hugolib: Extract the Fast Render Mode logic into a method 2018-01-30 10:49:24 +01:00
site_sections.go hugolib: Avoid scanning entire site to find the home 2018-02-25 10:50:44 +01:00
site_sections_test.go
site_stats_test.go
site_test.go Add a way to merge pages by language 2018-03-16 10:10:01 +01:00
site_url_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
siteJSONEncode_test.go
sitemap.go
sitemap_test.go
taxonomy.go
taxonomy_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
template_engines_test.go
template_test.go hugolib: Add additional test to TestTemplateLookupOrder 2018-02-05 08:38:04 +01:00
testhelpers_test.go Add support for a content dir set per language 2018-04-02 08:06:21 +02:00
translations.go