From b9b304a126edcc2d3d1e9ace7ad119415284c1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 27 Nov 2025 10:42:29 +0100 Subject: [PATCH] testing: Port integration tests to new templates structure As introduced in v0.146.0. Keep some legecy test to preserve backwards compatibility. --- cache/filecache/filecache_integration_test.go | 2 +- common/htime/htime_integration_test.go | 2 +- common/hugo/hugo_integration_test.go | 2 +- common/paths/paths_integration_test.go | 8 +- .../allconfig/allconfig_integration_test.go | 6 +- hugolib/404_test.go | 2 +- hugolib/alias_test.go | 6 +- hugolib/cascade_test.go | 20 +- hugolib/config_test.go | 66 ++-- hugolib/configdir_test.go | 2 +- hugolib/content_map_test.go | 20 +- hugolib/content_render_hooks_test.go | 46 +-- hugolib/datafiles_test.go | 6 +- hugolib/dates_test.go | 12 +- hugolib/disableKinds_test.go | 10 +- hugolib/embedded_templates_test.go | 4 +- hugolib/filesystems/basefs_test.go | 4 +- hugolib/frontmatter_test.go | 2 +- hugolib/hugo_modules_test.go | 14 +- hugolib/hugo_sites_build_errors_test.go | 58 ++-- hugolib/hugo_sites_build_test.go | 2 +- hugolib/hugo_sites_multihost_test.go | 12 +- hugolib/hugo_sites_test.go | 2 +- hugolib/hugo_smoke_test.go | 32 +- hugolib/hugolib_integration_test.go | 8 +- hugolib/language_content_dir_test.go | 2 +- hugolib/language_test.go | 4 +- hugolib/menu_test.go | 38 +-- hugolib/minify_publisher_test.go | 2 +- hugolib/mount_filters_test.go | 6 +- hugolib/page__fragments_test.go | 8 +- hugolib/page__meta_test.go | 6 +- hugolib/page_permalink_test.go | 4 +- hugolib/page_test.go | 58 ++-- hugolib/pagebundler_test.go | 60 ++-- hugolib/pagecollections_test.go | 40 +-- hugolib/pages_language_merge_test.go | 8 +- .../pagesfromgotmpl_integration_test.go | 42 +-- hugolib/paginator_test.go | 8 +- hugolib/params_test.go | 4 +- hugolib/rebuild_test.go | 182 +++++------ hugolib/rendershortcodes_test.go | 74 ++--- hugolib/renderstring_test.go | 32 +- hugolib/resource_chain_test.go | 12 +- hugolib/rss_test.go | 8 +- hugolib/securitypolicies_test.go | 18 +- hugolib/segments/segments_integration_test.go | 4 +- hugolib/siteJSONEncode_test.go | 2 +- hugolib/site_sections_test.go | 8 +- hugolib/site_stats_test.go | 2 +- hugolib/site_test.go | 18 +- hugolib/site_url_test.go | 2 +- hugolib/sitemap_test.go | 2 +- hugolib/taxonomy_test.go | 62 ++-- hugolib/template_test.go | 66 ++-- internal/js/esbuild/batch_integration_test.go | 26 +- langs/i18n/i18n_integration_test.go | 6 +- main_test.go | 6 + .../blockquotes_integration_test.go | 16 +- .../codeblocks/codeblocks_integration_test.go | 38 +-- markup/goldmark/goldmark_integration_test.go | 74 ++--- .../images/images_integration_test.go | 6 +- .../attributes/attributes_integration_test.go | 4 +- .../passthrough_integration_test.go | 6 +- .../tables/tables_integration_test.go | 12 +- markup/goldmark/toc_integration_test.go | 8 +- .../highlight/highlight_integration_test.go | 8 +- .../tableofcontents_integration_test.go | 4 +- related/related_integration_test.go | 6 +- .../images/images_golden_integration_test.go | 12 +- resources/images/images_integration_test.go | 4 +- resources/page/page_integration_test.go | 6 +- .../page/page_markup_integration_test.go | 24 +- .../pagemeta/pagemeta_integration_test.go | 4 +- .../page/pages_prev_next_integration_test.go | 2 +- resources/page/path_integration_test.go | 4 +- resources/page/permalinks_integration_test.go | 34 +-- resources/page/site_integration_test.go | 2 +- resources/page/taxonomy_integration_test.go | 10 +- .../resource/resources_integration_test.go | 4 +- .../create/create_integration_test.go | 6 +- .../babel/babel_integration_test.go | 2 +- .../cssjs/postcss_integration_test.go | 2 +- .../cssjs/tailwindcss_integration_test.go | 2 +- .../js/js_integration_test.go | 14 +- .../minifier/minifier_integration_test.go | 2 +- .../templates/templates_integration_test.go | 4 +- .../dartsass/dartsass_integration_test.go | 28 +- .../tocss/scss/scss_integration_test.go | 18 +- resources/resources_integration_test.go | 14 +- resources/transform_integration_test.go | 4 +- .../collections_integration_test.go | 22 +- tpl/debug/debug_integration_test.go | 6 +- tpl/fmt/fmt_integration_test.go | 4 +- tpl/images/images_integration_test.go | 6 +- tpl/os/os_integration_test.go | 4 +- tpl/page/page_integration_test.go | 28 +- tpl/partials/partials_integration_test.go | 66 ++-- tpl/resources/resources_integration_test.go | 14 +- tpl/templates/defer_integration_test.go | 20 +- tpl/templates/init.go | 4 +- tpl/templates/templates_integration_test.go | 26 +- tpl/tplimpl/legacy_integration_test.go | 38 --- tpl/tplimpl/render_hook_integration_test.go | 6 +- tpl/tplimpl/shortcodes_integration_test.go | 36 +-- tpl/tplimpl/template_funcs_test.go | 6 +- tpl/tplimpl/templatestore_integration_test.go | 282 ++---------------- .../templatestore_legacy1_integration_test.go | 275 +++++++++++++++++ tpl/tplimpl/tplimpl_integration_test.go | 36 +-- tpl/transform/transform_integration_test.go | 36 +-- 110 files changed, 1242 insertions(+), 1225 deletions(-) delete mode 100644 tpl/tplimpl/legacy_integration_test.go create mode 100644 tpl/tplimpl/templatestore_legacy1_integration_test.go diff --git a/cache/filecache/filecache_integration_test.go b/cache/filecache/filecache_integration_test.go index 1e920c29f..d17c4367b 100644 --- a/cache/filecache/filecache_integration_test.go +++ b/cache/filecache/filecache_integration_test.go @@ -67,7 +67,7 @@ title: "Home" --- -- assets/a/pixel.png -- iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg== --- layouts/index.html -- +-- layouts/home.html -- {{ warnf "HOME!" }} {{ $img := resources.GetMatch "**.png" }} {{ $img = $img.Resize "3x3" }} diff --git a/common/htime/htime_integration_test.go b/common/htime/htime_integration_test.go index 8090add12..596e9f130 100644 --- a/common/htime/htime_integration_test.go +++ b/common/htime/htime_integration_test.go @@ -26,7 +26,7 @@ func TestApplyWithContext(t *testing.T) { files := ` -- config.toml -- defaultContentLanguage = 'it' --- layouts/index.html -- +-- layouts/home.html -- {{ $dates := slice "2022-01-03" "2022-02-01" diff --git a/common/hugo/hugo_integration_test.go b/common/hugo/hugo_integration_test.go index 77dbb5c91..938600199 100644 --- a/common/hugo/hugo_integration_test.go +++ b/common/hugo/hugo_integration_test.go @@ -35,7 +35,7 @@ baseURL = 'https://en.example.org/' --- title: home --- --- layouts/index.html -- +-- layouts/home.html -- multilingual={{ hugo.IsMultilingual }} multihost={{ hugo.IsMultihost }} ` diff --git a/common/paths/paths_integration_test.go b/common/paths/paths_integration_test.go index f5ea3066a..3f3f786f9 100644 --- a/common/paths/paths_integration_test.go +++ b/common/paths/paths_integration_test.go @@ -35,9 +35,9 @@ weight = 2 removePathAccents = true -- content/διακριτικός.md -- -- content/διακριτικός.fr.md -- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Language.Lang }}|Single. --- layouts/_default/list.html -- +-- layouts/list.html -- List ` b := hugolib.Test(t, files) @@ -64,9 +64,9 @@ disablePathToLower = true -- content/MySection/MyPage.fr.md -- -- content/MySection/MyBundle/index.md -- -- content/MySection/MyBundle/index.fr.md -- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Language.Lang }}|Single. --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Language.Lang }}|List. ` b := hugolib.Test(t, files) diff --git a/config/allconfig/allconfig_integration_test.go b/config/allconfig/allconfig_integration_test.go index 54a2cc091..6899cf21c 100644 --- a/config/allconfig/allconfig_integration_test.go +++ b/config/allconfig/allconfig_integration_test.go @@ -39,7 +39,7 @@ title: "p1" --- title: "p1" --- --- layouts/_default/single.html -- +-- layouts/single.html -- Title: {{ .Title }} ` @@ -141,7 +141,7 @@ disableKinds = ["taxonomy", "term"] [pagination] disableAliases = true pagerSize = 2 --- layouts/_default/list.html -- +-- layouts/list.html -- {{ $paginator := .Paginate site.RegularPages }} {{ template "_internal/pagination.html" . }} {{ range $paginator.Pages }} @@ -191,7 +191,7 @@ func TestInvalidOutputFormat(t *testing.T) { disableKinds = ['page','rss','section','sitemap','taxonomy','term'] [outputs] home = ['html','foo'] --- layouts/index.html -- +-- layouts/home.html -- x ` diff --git a/hugolib/404_test.go b/hugolib/404_test.go index 36738e428..90e804c2d 100644 --- a/hugolib/404_test.go +++ b/hugolib/404_test.go @@ -72,7 +72,7 @@ baseURL = "http://example.com/" disableLiveReload = true [internal] fastRenderMode = true --- layouts/_default/baseof.html -- +-- layouts/baseof.html -- Base: {{ block "main" . }}{{ end }} -- layouts/404.html -- {{ define "main" }} diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go index 32a95d608..b7944b597 100644 --- a/hugolib/alias_test.go +++ b/hugolib/alias_test.go @@ -72,11 +72,11 @@ func TestAliasMultipleOutputFormats(t *testing.T) { files := ` -- hugo.toml -- baseURL = "http://example.com" --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Content }} --- layouts/_default/single.amp.html -- +-- layouts/single.amp.html -- {{ .Content }} --- layouts/_default/single.json -- +-- layouts/single.json -- {{ .Content }} -- content/blog/page.md -- --- diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go index d9d915a42..fa8e5e434 100644 --- a/hugolib/cascade_test.go +++ b/hugolib/cascade_test.go @@ -83,9 +83,9 @@ title: P1 title: P2 tags: [t1, t2] --- --- layouts/_default/list.html -- +-- layouts/list.html -- List: {{ len .Pages }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Single: Tags: {{ site.Taxonomies.tags }}| ` @@ -105,9 +105,9 @@ func TestCascadeEditIssue12449(t *testing.T) { baseURL = "https://example.com" disableKinds = ['sitemap','rss', 'home', 'taxonomy','term'] disableLiveReload = true --- layouts/_default/list.html -- +-- layouts/list.html -- Title: {{ .Title }}|{{ .Content }}|cascadeparam: {{ .Params.cascadeparam }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Title: {{ .Title }}|{{ .Content }}|cascadeparam: {{ .Params.cascadeparam }}| -- content/mysect/_index.md -- --- @@ -160,9 +160,9 @@ path = '/s1**' --- title: p1 --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }}| --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }}| ` b := Test(t, files) @@ -195,9 +195,9 @@ cascade: --- title: p1 --- --- layouts/_default/single.html -- +-- layouts/single.html -- Background: {{ .Params.background }}| --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }}| ` @@ -214,9 +214,9 @@ func TestCascadeOverlap(t *testing.T) { files := ` -- hugo.toml -- disableKinds = ['home','rss','sitemap','taxonomy','term'] --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} -- content/s/_index.md -- --- diff --git a/hugolib/config_test.go b/hugolib/config_test.go index 70b49f806..3f1e7e6e9 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -163,7 +163,7 @@ p2 = "p2base" [params.pm2] pm21 = "pm21base" pm22 = "pm22base" --- layouts/index.html -- +-- layouts/home.html -- p1: {{ .Site.Params.p1 }} p2: {{ .Site.Params.p2 }} pm21: {{ .Site.Params.pm2.pm21 }} @@ -212,7 +212,7 @@ p2 = "p2en" sub1 = "sub1en" [languages.sv] title = "Svensk Title Theme" --- layouts/index.html -- +-- layouts/home.html -- title: {{ .Title }}| p1: {{ .Site.Params.p1 }}| p2: {{ .Site.Params.p2 }}| @@ -244,7 +244,7 @@ weight = 2 [languages.no] weight = 3 --- layouts/index.html -- +-- layouts/home.html -- Home. ` @@ -522,7 +522,7 @@ t3 = "tv3d" -- themes/test-theme/config/production/config.toml -- [params] t3 = "tv3p" --- layouts/index.html -- +-- layouts/home.html -- m1: {{ .Site.Params.m1 }} m2: {{ .Site.Params.m2 }} t1: {{ .Site.Params.t1 }} @@ -551,7 +551,7 @@ func TestPrivacyConfig(t *testing.T) { someOtherValue = "foo" [privacy.youtube] privacyEnhanced = true --- layouts/index.html -- +-- layouts/home.html -- Privacy Enhanced: {{ .Site.Config.Privacy.YouTube.PrivacyEnhanced }} ` b := Test(t, files) @@ -645,7 +645,7 @@ func TestInvalidDefaultMarkdownHandler(t *testing.T) { defaultMarkdownHandler = 'blackfriday' -- content/_index.md -- ## Foo --- layouts/index.html -- +-- layouts/home.html -- {{ .Content }} ` @@ -677,7 +677,7 @@ themeconfigdirparam = "themeconfigdirvalue" -- themes/mytheme/hugo.toml -- [params] themeparam = "themevalue" --- layouts/index.html -- +-- layouts/home.html -- rootparam: {{ site.Params.rootparam }} rootconfigparam: {{ site.Params.rootconfigparam }} themeparam: {{ site.Params.themeparam }} @@ -725,9 +725,9 @@ weigHt = WEIGHT_EN title = "Swedish" wEight = WEIGHT_SV disableKinds = ["page"] --- layouts/index.html -- +-- layouts/home.html -- Home: {{ .Lang}}|{{ len site.RegularPages }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Single. -- content/p1.en.md -- -- content/p2.en.md -- @@ -792,7 +792,7 @@ mediaType = 'text/html' [outputFormats.myformat] baseName = 'myindex' mediaType = 'text/html' --- layouts/index.html -- +-- layouts/home.html -- Home. @@ -827,7 +827,7 @@ myparam = "enParamValue" title = "Svensk Title" [languages.sv.params] myparam = "svParamValue" --- layouts/index.html -- +-- layouts/home.html -- MyParam: {{ site.Params.myparam }} ThisIsAParam: {{ site.Params.thisIsAParam }} @@ -873,7 +873,7 @@ title: "My English Section" --- title: "My Swedish Section" --- --- layouts/index.html -- +-- layouts/home.html -- LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Language.LanguageCode }}| {{ range $i, $e := (slice site .Site) }} {{ $i }}|AllPages: {{ len .AllPages }}|Sections: {{ if .Sections }}true{{ end }}|BuildDrafts: {{ .BuildDrafts }}|Param: {{ .Language.Params.myparam }}|Language string: {{ .Language }}|Languages: {{ .Languages }} @@ -914,7 +914,7 @@ params: mainSections: -- content/mysection/_index.md -- -- content/mysection/mycontent.md -- --- layouts/index.html -- +-- layouts/home.html -- mainSections: {{ site.Params.mainSections }} ` @@ -930,7 +930,7 @@ func TestConfigHugoWorkingDir(t *testing.T) { files := ` -- hugo.toml -- --- layouts/index.html -- +-- layouts/home.html -- WorkingDir: {{ hugo.WorkingDir }}| ` @@ -971,7 +971,7 @@ p1 = "p1de" [languages.de.markup.goldmark.extensions.typographer] leftDoubleQuote = '«' # default “ rightDoubleQuote = '»' # default ” --- layouts/index.html -- +-- layouts/home.html -- {{ .Content }} p1: {{ site.Params.p1 }}| -- content/_index.en.md -- @@ -1002,7 +1002,7 @@ func TestConfigLegacyValues(t *testing.T) { # taxonomyTerm was renamed to taxonomy in Hugo 0.60.0. disableKinds = ["taxonomyTerm"] --- layouts/index.html -- +-- layouts/home.html -- Home ` @@ -1042,9 +1042,9 @@ notAlternative = true --- outputs: ["html", "htaccess"] --- --- layouts/index.html -- +-- layouts/home.html -- HTML. --- layouts/_default/list.htaccess -- +-- layouts/list.htaccess -- HTACCESS. @@ -1061,7 +1061,7 @@ func TestConfigLanguageCodeTopLevel(t *testing.T) { files := ` -- hugo.toml -- languageCode = "en-US" --- layouts/index.html -- +-- layouts/home.html -- LanguageCode: {{ .Site.LanguageCode }}|{{ site.Language.LanguageCode }}| @@ -1087,7 +1087,7 @@ path = "foo" [languages.sv.mediatypes."text/html"] suffixes = ["bar"] --- layouts/index.html -- +-- layouts/home.html -- Home. @@ -1115,7 +1115,7 @@ func TestConfigMiscPanics(t *testing.T) { files := ` -- hugo.yaml -- params: --- layouts/index.html -- +-- layouts/home.html -- Foo: {{ site.Params.foo }}| @@ -1139,7 +1139,7 @@ defaultContentLanguage = "en" lang = "en" languageName = "English" weight = 1 --- layouts/index.html -- +-- layouts/home.html -- Foo: {{ site.Params.foo }}| @@ -1191,7 +1191,7 @@ func TestConfigModuleDefaultMountsInConfig(t *testing.T) { -- hugo.toml -- baseURL = "https://example.org" contentDir = "mycontent" --- layouts/index.html -- +-- layouts/home.html -- Home. @@ -1216,7 +1216,7 @@ defaultContentLanguageInSubdir = true disableKinds = ["taxonomy", "term", "page", "section"] -- content/foo/bar.txt -- Foo. --- layouts/index.html -- +-- layouts/home.html -- Home. ` b := Test(t, files) @@ -1244,7 +1244,7 @@ title = "English Title" title = "Swedish Title" -- content/foo/bar.txt -- Foo. --- layouts/index.html -- +-- layouts/home.html -- Home. ` b := Test(t, files) @@ -1272,7 +1272,7 @@ title = "English Title" title = "Swedish Title" -- content/foo/bar.txt -- Foo. --- layouts/index.html -- +-- layouts/home.html -- Home. ` b := Test(t, files) @@ -1295,7 +1295,7 @@ title = "English Title" [languages.sv] title = "Swedish Title" disabled = true --- layouts/index.html -- +-- layouts/home.html -- Home. @@ -1317,7 +1317,7 @@ disableDefaultLanguageRedirect = true title = "English Title" [languages.sv] title = "Swedish Title" --- layouts/index.html -- +-- layouts/home.html -- Home. @@ -1450,9 +1450,9 @@ category = 'categories' title: "P1" categories: ["c1"] --- --- layouts/index.html -- +-- layouts/home.html -- Home. --- layouts/_default/list.html -- +-- layouts/list.html -- List. @@ -1473,7 +1473,7 @@ func TestKindsUnknown(t *testing.T) { disableKinds = ['foo', 'home'] [outputs] foo = ['HTML', 'AMP', 'RSS'] --- layouts/_default/list.html -- +-- layouts/list.html -- List. @@ -1499,7 +1499,7 @@ func TestDeprecateTaxonomyTerm(t *testing.T) { disableKinds = ['taxonomyTerm'] [outputs] taxonomyterm = ['HTML', 'AMP', 'RSS'] --- layouts/_default/list.html -- +-- layouts/list.html -- List. @@ -1530,7 +1530,7 @@ title = "English" [languages.pt] weight = 2 title = "Portuguese" --- layouts/index.html -- +-- layouts/home.html -- Home. -- content/custom/index.br.md -- --- diff --git a/hugolib/configdir_test.go b/hugolib/configdir_test.go index 39505563d..e47b75cee 100644 --- a/hugolib/configdir_test.go +++ b/hugolib/configdir_test.go @@ -35,7 +35,7 @@ ignoreErrors = ["error-missing-instagram-accesstoken"] a = "a1" b = "b1" c = "c1" --- layouts/index.html -- +-- layouts/home.html -- Params: {{ site.Params}} ` b := Test(t, files) diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go index 2be88a78e..92196b67f 100644 --- a/hugolib/content_map_test.go +++ b/hugolib/content_map_test.go @@ -54,7 +54,7 @@ draft: true files := ` -- hugo.toml -- baseURL = "http://example.com" --- layouts/index.html -- +-- layouts/home.html -- Num Regular: {{ len .Site.RegularPages }}|{{ range .Site.RegularPages }}{{ .RelPermalink }}|{{ end }}$ Main Sections: {{ .Site.Params.mainSections }} Pag Num Pages: {{ len .Paginator.Pages }} @@ -205,7 +205,7 @@ func TestIntegrationTestTemplate(t *testing.T) { -- config.toml -- title = "Integration Test" disableKinds=["page", "section", "taxonomy", "term", "sitemap", "robotsTXT", "RSS"] --- layouts/index.html -- +-- layouts/home.html -- Home: {{ .Title }}| ` @@ -235,7 +235,7 @@ weight = 1 weight = 2 [languages.de] weight = 3 --- layouts/index.html -- +-- layouts/home.html -- {{ $bundle := site.GetPage "bundle" }} {{ $r := $bundle.Resources.GetMatch "*.txt" }} {{ .Language.Lang }}: {{ with $r }}{{ .RelPermalink }}|{{ .Content }}{{ end}} @@ -276,7 +276,7 @@ disableKinds = ["taxonomy", "term"] -- content/bundle/index.md -- -- content/bundle/data with Spaces.txt -- Data. --- layouts/index.html -- +-- layouts/home.html -- {{ $bundle := site.GetPage "bundle" }} {{ $r := $bundle.Resources.Get "data with Spaces.txt" }} R: {{ with $r }}{{ .Content }}{{ end }}| @@ -300,7 +300,7 @@ data 1.txt Data 1.txt -- content/bundle/Data-1.txt -- Data-1.txt --- layouts/index.html -- +-- layouts/home.html -- {{ $bundle := site.GetPage "bundle" }} {{ $r := $bundle.Resources.Get "data-1.txt" }} R: {{ with $r }}{{ .Content }}{{ end }}|Len: {{ len $bundle.Resources }}|$ @@ -329,9 +329,9 @@ foo.txt p1.txt -- content/s1/p1-foo.txt -- p1-foo.txt --- layouts/_default/list.html -- +-- layouts/list.html -- {{.Title }}| --- layouts/_default/single.html -- +-- layouts/single.html -- {{.Title }}| ` @@ -361,7 +361,7 @@ title: s1 --- -- content/s1x/a.txt -- a.txt --- layouts/index.html -- +-- layouts/home.html -- Home. {{ range .Resources.Match "**" }} {{ .Name }}| @@ -386,7 +386,7 @@ defaultContentLanguageInSubdir = true [languages.en] [sitemap] filename = 'foo.xml' --- layouts/index.html -- +-- layouts/home.html -- irrelevant ` @@ -497,7 +497,7 @@ title: p1

b

-- content/p1/c.html --

c

--- layouts/_default/single.html -- +-- layouts/single.html -- Path: {{ .Path }}|{{.Kind }} |{{ (.Resources.Get "a.html").RelPermalink -}} |{{ (.Resources.Get "b.html").RelPermalink -}} diff --git a/hugolib/content_render_hooks_test.go b/hugolib/content_render_hooks_test.go index 063d695da..f6015ad22 100644 --- a/hugolib/content_render_hooks_test.go +++ b/hugolib/content_render_hooks_test.go @@ -26,7 +26,7 @@ func TestRenderHooksRSS(t *testing.T) { -- hugo.toml -- baseURL = "https://example.org" disableKinds = ["taxonomy", "term"] --- layouts/index.html -- +-- layouts/home.html -- {{ $p := site.GetPage "p1.md" }} {{ $p2 := site.GetPage "p2.md" }} P1: {{ $p.Content }} @@ -36,13 +36,13 @@ P2: {{ $p2.Content }} {{ $p3 := site.GetPage "p3.md" }} P2: {{ $p2.Content }} P3: {{ $p3.Content }} --- layouts/_default/_markup/render-link.html -- +-- layouts/_markup/render-link.html -- html-link: {{ .Destination | safeURL }}| --- layouts/_default/_markup/render-link.rss.xml -- +-- layouts/_markup/render-link.rss.xml -- xml-link: {{ .Destination | safeURL }}| --- layouts/_default/_markup/render-heading.html -- +-- layouts/_markup/render-heading.html -- html-heading: {{ .Text }}| --- layouts/_default/_markup/render-heading.rss.xml -- +-- layouts/_markup/render-heading.rss.xml -- xml-heading: {{ .Text }}| -- content/p1.md -- --- @@ -87,7 +87,7 @@ func TestRenderHooksRSSOnly(t *testing.T) { -- hugo.toml -- baseURL = "https://example.org" disableKinds = ["taxonomy", "term"] --- layouts/index.html -- +-- layouts/home.html -- {{ $p := site.GetPage "p1.md" }} {{ $p2 := site.GetPage "p2.md" }} P1: {{ $p.Content }} @@ -97,9 +97,9 @@ P2: {{ $p2.Content }} {{ $p3 := site.GetPage "p3.md" }} P2: {{ $p2.Content }} P3: {{ $p3.Content }} --- layouts/_default/_markup/render-link.rss.xml -- +-- layouts/_markup/render-link.rss.xml -- xml-link: {{ .Destination | safeURL }}| --- layouts/_default/_markup/render-heading.rss.xml -- +-- layouts/_markup/render-heading.rss.xml -- xml-heading: {{ .Text }}| -- content/p1.md -- --- @@ -150,12 +150,12 @@ baseURL="https://example.org" [markup.goldmark] [markup.goldmark.renderer] unsafe = true --- layouts/index.html -- +-- layouts/home.html -- {{ $p := site.GetPage "p1.md" }} P1: {{ $p.Content }} --- layouts/_default/_markup/render-link.html -- +-- layouts/_markup/render-link.html -- html-link: {{ .Destination | safeURL }}|Text: {{ .Text }}|Plain: {{ .PlainText | safeHTML }} --- layouts/_default/_markup/render-image.html -- +-- layouts/_markup/render-image.html -- html-image: {{ .Destination | safeURL }}|Text: {{ .Text }}|Plain: {{ .PlainText | safeHTML }} -- content/p1.md -- --- @@ -203,7 +203,7 @@ title: "p2" ## E ## F --- layouts/_default/_markup/render-heading.html -- +-- layouts/_markup/render-heading.html -- Heading: {{ .Text }}| {{ with .Page }} Self Fragments: {{ .Fragments.Identifiers }}| @@ -211,7 +211,7 @@ Self Fragments: {{ .Fragments.Identifiers }}| {{ with (site.GetPage "p1.md") }} P1 Fragments: {{ .Fragments.Identifiers }}| {{ end }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Content}} ` @@ -276,7 +276,7 @@ title: "p2 en" iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg== -- content/p2/pixel.png -- iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg== --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }}|{{ .Content }}|$ ` @@ -322,7 +322,7 @@ Link: [text-"<>&](/destination-"<> 'title-"<>&') Image: ![alt-"<>&](/destination-"<> 'title-"<>&') {class=">" id="baz"} --- layouts/index.html -- +-- layouts/home.html -- {{ .Content }} ` @@ -362,9 +362,9 @@ title: "p1" First line. Second line. ---------------- --- layouts/_default/_markup/render-heading.html -- +-- layouts/_markup/render-heading.html -- Plain text: {{ .PlainText }}|Text: {{ .Text }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Content: {{ .Content}}| } ` @@ -379,13 +379,13 @@ Content: {{ .Content}}| func TestContentOutputReuseRenderHooksAndShortcodesHTMLOnly(t *testing.T) { files := ` -- hugo.toml -- --- layouts/index.html -- +-- layouts/home.html -- HTML: {{ .Title }}|{{ .Content }}| -- layouts/index.xml -- XML: {{ .Title }}|{{ .Content }}| -- layouts/_markup/render-heading.html -- Render heading. --- layouts/shortcodes/myshortcode.html -- +-- layouts/_shortcodes/myshortcode.html -- My shortcode. -- content/_index.md -- --- @@ -407,7 +407,7 @@ func TestContentOutputNoReuseRenderHooksInBothHTMLAnXML(t *testing.T) { files := ` -- hugo.toml -- disableKinds = ["taxonomy", "term"] --- layouts/index.html -- +-- layouts/home.html -- HTML: {{ .Title }}|{{ .Content }}| -- layouts/index.xml -- XML: {{ .Title }}|{{ .Content }}| @@ -435,16 +435,16 @@ func TestContentOutputNoReuseShortcodesInBothHTMLAnXML(t *testing.T) { files := ` -- hugo.toml -- disableKinds = ["taxonomy", "term"] --- layouts/index.html -- +-- layouts/home.html -- HTML: {{ .Title }}|{{ .Content }}| -- layouts/index.xml -- XML: {{ .Title }}|{{ .Content }}| -- layouts/_markup/render-heading.html -- Render heading. --- layouts/shortcodes/myshortcode.html -- +-- layouts/_shortcodes/myshortcode.html -- My shortcode HTML. --- layouts/shortcodes/myshortcode.xml -- +-- layouts/_shortcodes/myshortcode.xml -- My shortcode XML. -- content/_index.md -- --- diff --git a/hugolib/datafiles_test.go b/hugolib/datafiles_test.go index 657e6020c..4b1b6739f 100644 --- a/hugolib/datafiles_test.go +++ b/hugolib/datafiles_test.go @@ -36,7 +36,7 @@ v1: c_d_v1 v1 = "a_v1_theme" -- themes/mytheme/data/d.toml -- v1 = "d_v1_theme" --- layouts/index.html -- +-- layouts/home.html -- a: {{ site.Data.a.v1 }}| b: {{ site.Data.b.v1 }}| cd: {{ site.Data.c.d.v1 }}| @@ -56,7 +56,7 @@ func TestDataMixedCaseFolders(t *testing.T) { baseURL = "https://example.com" -- data/MyFolder/MyData.toml -- v1 = "my_v1" --- layouts/index.html -- +-- layouts/home.html -- {{ site.Data }} v1: {{ site.Data.MyFolder.MyData.v1 }}| ` @@ -74,7 +74,7 @@ func TestDataNoAssets(t *testing.T) { disableKinds = ['page','rss','section','sitemap','taxonomy','term'] -- assets/data/foo.toml -- content = "I am assets/data/foo.toml" --- layouts/index.html -- +-- layouts/home.html -- |{{ site.Data.foo.content }}| ` diff --git a/hugolib/dates_test.go b/hugolib/dates_test.go index c99545e8a..64c9e3dfb 100644 --- a/hugolib/dates_test.go +++ b/hugolib/dates_test.go @@ -44,7 +44,7 @@ date: 2021-07-18 title: Page date: 2021-07-18 --- --- layouts/index.html -- +-- layouts/home.html -- Date: {{ .Date | time.Format ":date_long" }} ` @@ -111,7 +111,7 @@ weight=10 [languages.nn] timeZone="America/Antigua" weight=20 --- layouts/_default/single.html -- +-- layouts/single.html -- Date: {{ .Date | safeHTML }} Lastmod: {{ .Lastmod | safeHTML }} PublishDate: {{ .PublishDate | safeHTML }} @@ -192,7 +192,7 @@ func TestTimeOnError(t *testing.T) { files := ` -- hugo.toml -- --- layouts/index.html -- +-- layouts/home.html -- time: {{ time "2020-10-20" "invalid-timezone" }} -- content/p1.md -- ` @@ -228,7 +228,7 @@ talks = [ { date = 2050-02-12, name = "Future talk 1" }, { date = 2050-02-13, name = "Future talk 2" }, ] --- layouts/index.html -- +-- layouts/home.html -- {{ $futureTalks := where site.Data.mydata.talks "date" ">" now }} {{ $pastTalks := where site.Data.mydata.talks "date" "<" now }} @@ -266,11 +266,11 @@ func TestPublisDateRollupIssue12438(t *testing.T) { disableKinds = ['home','rss','sitemap'] [taxonomies] tag = 'tags' --- layouts/_default/list.html -- +-- layouts/list.html -- Date: {{ .Date.Format "2006-01-02" }} PublishDate: {{ .PublishDate.Format "2006-01-02" }} Lastmod: {{ .Lastmod.Format "2006-01-02" }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} -- content/s1/p1.md -- --- diff --git a/hugolib/disableKinds_test.go b/hugolib/disableKinds_test.go index 1ee312347..25a8c94f6 100644 --- a/hugolib/disableKinds_test.go +++ b/hugolib/disableKinds_test.go @@ -28,7 +28,7 @@ baseURL = "http://example.com/blog" enableRobotsTXT = true ignoreErrors = ["error-disable-taxonomy"] disableKinds = ["%s"] --- layouts/_default/single.html -- +-- layouts/single.html -- single -- content/sect/page.md -- --- @@ -209,7 +209,7 @@ func TestDisableRSSWithRSSInCustomOutputs(t *testing.T) { disableKinds = ["term", "taxonomy", "RSS"] [outputs] home = [ "HTML", "RSS" ] --- layouts/index.html -- +-- layouts/home.html -- Home ` b := Test(t, files) @@ -224,7 +224,7 @@ func TestBundleNoPublishResources(t *testing.T) { files := ` -- hugo.toml -- baseURL = "http://example.com" --- layouts/index.html -- +-- layouts/home.html -- {{ $bundle := site.GetPage "section/bundle-false" }} {{ $data1 := $bundle.Resources.GetMatch "data1*" }} Data1: {{ $data1.RelPermalink }} @@ -256,7 +256,7 @@ func TestNoRenderAndNoPublishResources(t *testing.T) { files := ` -- hugo.toml -- baseURL = "http://example.com" --- layouts/index.html -- +-- layouts/home.html -- {{ $page := site.GetPage "sect/no-render" }} {{ $sect := site.GetPage "sect-no-render" }} @@ -321,7 +321,7 @@ title: "Page 1 en" --- title: "Page 2 nn" --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} ` b := Test(t, files) diff --git a/hugolib/embedded_templates_test.go b/hugolib/embedded_templates_test.go index 80f773099..c93ccdf9f 100644 --- a/hugolib/embedded_templates_test.go +++ b/hugolib/embedded_templates_test.go @@ -41,7 +41,7 @@ lastmod: 2021-05-22T19:25:00+01:00 --- title: My Site --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ template "_internal/twitter_cards.html" . }} {{ template "_internal/opengraph.html" . }} @@ -138,7 +138,7 @@ title: p09 --- title: p10 --- --- layouts/index.html -- +-- layouts/home.html -- {{ .Paginate (where site.RegularPages "Section" "s1") }}` + variant + ` ` b := Test(t, files) diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go index 4a6e0bbaf..6f02f2c7f 100644 --- a/hugolib/filesystems/basefs_test.go +++ b/hugolib/filesystems/basefs_test.go @@ -480,7 +480,7 @@ target = "content/posts" [[module.mounts]] source = "docs" target = "content/mydocs" --- layouts/index.html -- +-- layouts/home.html -- Home. ` @@ -554,7 +554,7 @@ JS. body { color: red; } -- assets/scss/app.scss -- body { color: blue; } --- layouts/index.html -- +-- layouts/home.html -- Home. SCSS: {{ with resources.Get "scss/app.scss" }}{{ .RelPermalink }}|{{ .Content }}{{ end }}| # Note that the pattern below will match 2 resources, which doesn't make much sense, diff --git a/hugolib/frontmatter_test.go b/hugolib/frontmatter_test.go index c4cbfa72e..8b8937f49 100644 --- a/hugolib/frontmatter_test.go +++ b/hugolib/frontmatter_test.go @@ -26,7 +26,7 @@ ints: [1, 2, 3] mixed: ["1", 2, 3] strings: ["1", "2","3"] --- --- layouts/_default/single.html -- +-- layouts/single.html -- Ints: {{ printf "%T" .Params.ints }} {{ range .Params.ints }}Int: {{ fmt.Printf "%[1]v (%[1]T)" . }}|{{ end }} Mixed: {{ printf "%T" .Params.mixed }} {{ range .Params.mixed }}Mixed: {{ fmt.Printf "%[1]v (%[1]T)" . }}|{{ end }} Strings: {{ printf "%T" .Params.strings }} {{ range .Params.strings }}Strings: {{ fmt.Printf "%[1]v (%[1]T)" . }}|{{ end }} diff --git a/hugolib/hugo_modules_test.go b/hugolib/hugo_modules_test.go index 03c70239d..84c41a216 100644 --- a/hugolib/hugo_modules_test.go +++ b/hugolib/hugo_modules_test.go @@ -82,7 +82,7 @@ languageName = "French" weight = 4 title = "French Title" --- layouts/index.html -- +-- layouts/home.html -- {{ range .Site.RegularPages }} |{{ .Title }}|{{ .RelPermalink }}|{{ .Plain }} {{ end }} @@ -158,7 +158,7 @@ ignoreConfig=true -- themes/a/config.toml -- [params] a = "Should Be Ignored!" --- layouts/index.html -- +-- layouts/home.html -- Params: {{ .Site.Params }} ` Test(t, files).AssertFileContent("public/index.html", "! Ignored") @@ -182,7 +182,7 @@ a = "A param" -- themes/b/config.toml -- [params] b = "B param" --- layouts/index.html -- +-- layouts/home.html -- Params: {{ .Site.Params }} ` Test(t, files).AssertFileContent("public/index.html", "A param", "! B param") @@ -236,7 +236,7 @@ baseURL="https://example.org" [[module.mounts]] source="mycontent" target="content" --- layouts/_default/single.html -- +-- layouts/single.html -- Permalink: {{ .Permalink }}| -- mycontent/mypage.md -- --- @@ -260,7 +260,7 @@ source = "README.md" target = "content/_index.md" -- README.md -- # Hello World --- layouts/index.html -- +-- layouts/home.html -- Home: {{ .Title }}|{{ .Content }}| ` b := Test(t, files) @@ -303,7 +303,7 @@ target = "content/resources-a" [[module.mounts]] source = "extra-content" target = "content/resources-b" --- layouts/_default/single.html -- +-- layouts/single.html -- Single -- content/p1.md -- -- extra-content/_index.md -- @@ -332,7 +332,7 @@ source = "extra-data" target = "data/extra" -- extra-data/test.yaml -- message: Hugo Rocks --- layouts/index.html -- +-- layouts/home.html -- {{ site.Data.extra.test.message }} ` diff --git a/hugolib/hugo_sites_build_errors_test.go b/hugolib/hugo_sites_build_errors_test.go index 709f1c34d..345790dc6 100644 --- a/hugolib/hugo_sites_build_errors_test.go +++ b/hugolib/hugo_sites_build_errors_test.go @@ -62,13 +62,13 @@ func TestSiteBuildErrors(t *testing.T) { return ` -- hugo.toml -- baseURL = "https://example.com" --- layouts/shortcodes/sc.html -- +-- layouts/_shortcodes/sc.html -- ` + f(shortcode, `SHORTCODE L1 SHORTCODE L2 SHORTCODE L3: SHORTCODE L4: {{ .Page.Title }} `) + ` --- layouts/_default/baseof.html -- +-- layouts/baseof.html -- ` + f(base, `BASEOF L1 BASEOF L2 BASEOF L3 @@ -76,7 +76,7 @@ BASEOF L4{{ if .Title }}{{ end }} {{block "main" .}}This is the main content.{{end}} BASEOF L6 `) + ` --- layouts/_default/single.html -- +-- layouts/single.html -- ` + f(single, `{{ define "main" }} SINGLE L2: SINGLE L3: @@ -169,7 +169,7 @@ Some content. fe := a.getFileError(err) a.c.Assert(fe.Position().LineNumber, qt.Equals, 5) a.c.Assert(fe.Position().ColumnNumber, qt.Equals, 14) - a.assertErrorMessage("\"layouts/_default/single.html:5:14\": execute of template failed", fe.Error()) + a.assertErrorMessage("\"layouts/single.html:5:14\": execute of template failed", fe.Error()) }, }, { @@ -182,7 +182,7 @@ Some content. fe := a.getFileError(err) a.c.Assert(fe.Position().LineNumber, qt.Equals, 5) a.c.Assert(fe.Position().ColumnNumber, qt.Equals, 14) - a.assertErrorMessage("\"layouts/_default/single.html:5:14\": execute of template failed", fe.Error()) + a.assertErrorMessage("\"layouts/single.html:5:14\": execute of template failed", fe.Error()) }, }, { @@ -204,7 +204,7 @@ Some content. assertErr: func(a testSiteBuildErrorAsserter, err error) { fe := a.getFileError(err) // Make sure that it contains both the content file and template - a.assertErrorMessage(`"content/myyaml.md:7:10": failed to render shortcode "sc": failed to process shortcode: "layouts/shortcodes/sc.html:4:22": execute of template failed: template: shortcodes/sc.html:4:22: executing "shortcodes/sc.html" at <.Page.Titles>: can't evaluate field Titles in type page.Page`, fe.Error()) + a.assertErrorMessage(`"content/myyaml.md:7:10": failed to render shortcode "sc": failed to process shortcode: "layouts/_shortcodes/sc.html:4:22": execute of template failed: template: shortcodes/sc.html:4:22: executing "shortcodes/sc.html" at <.Page.Titles>: can't evaluate field Titles in type page.Page`, fe.Error()) a.c.Assert(fe.Position().LineNumber, qt.Equals, 7) }, }, @@ -309,7 +309,7 @@ func TestErrorMinify(t *testing.T) { [minify] minifyOutput = true --- layouts/index.html -- +-- layouts/home.html -- @@ -338,16 +338,16 @@ func TestErrorNestedRender(t *testing.T) { --- title: "Home" --- --- layouts/index.html -- +-- layouts/home.html -- line 1 line 2 1{{ .Render "myview" }} --- layouts/_default/myview.html -- +-- layouts/myview.html -- line 1 12{{ partial "foo.html" . }} line 4 line 5 --- layouts/partials/foo.html -- +-- layouts/_partials/foo.html -- line 1 line 2 123{{ .ThisDoesNotExist }} @@ -361,7 +361,7 @@ line 4 b.Assert(errors, qt.HasLen, 4) b.Assert(errors[0].Position().LineNumber, qt.Equals, 3) b.Assert(errors[0].Position().ColumnNumber, qt.Equals, 4) - b.Assert(errors[0].Error(), qt.Contains, filepath.FromSlash(`"/layouts/index.html:3:4": execute of template failed`)) + b.Assert(errors[0].Error(), qt.Contains, filepath.FromSlash(`"/layouts/home.html:3:4": execute of template failed`)) b.Assert(errors[0].ErrorContext().Lines, qt.DeepEquals, []string{"line 1", "line 2", "1{{ .Render \"myview\" }}"}) b.Assert(errors[2].Position().LineNumber, qt.Equals, 2) b.Assert(errors[2].Position().ColumnNumber, qt.Equals, 5) @@ -385,17 +385,17 @@ title: "Home" ## Hello {{< hello >}} --- layouts/index.html -- +-- layouts/home.html -- line 1 line 2 {{ .Content }} line 5 --- layouts/shortcodes/hello.html -- +-- layouts/_shortcodes/hello.html -- line 1 12{{ partial "foo.html" . }} line 4 line 5 --- layouts/partials/foo.html -- +-- layouts/_partials/foo.html -- line 1 line 2 123{{ .ThisDoesNotExist }} @@ -412,7 +412,7 @@ line 4 b.Assert(errors[1].Position().LineNumber, qt.Equals, 6) b.Assert(errors[1].Position().ColumnNumber, qt.Equals, 1) b.Assert(errors[1].ErrorContext().ChromaLexer, qt.Equals, "md") - b.Assert(errors[1].Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:6:1": failed to render shortcode "hello": failed to process shortcode: "/layouts/shortcodes/hello.html:2:5":`)) + b.Assert(errors[1].Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:6:1": failed to render shortcode "hello": failed to process shortcode: "/layouts/_shortcodes/hello.html:2:5":`)) b.Assert(errors[1].ErrorContext().Lines, qt.DeepEquals, []string{"", "## Hello", "{{< hello >}}", ""}) b.Assert(errors[2].ErrorContext().Lines, qt.DeepEquals, []string{"line 1", "12{{ partial \"foo.html\" . }}", "line 4", "line 5"}) b.Assert(errors[3].Position().LineNumber, qt.Equals, 3) @@ -432,12 +432,12 @@ title: "Home" ## Hello --- layouts/index.html -- +-- layouts/home.html -- line 1 line 2 {{ .Content }} line 5 --- layouts/_default/_markup/render-heading.html -- +-- layouts/_markup/render-heading.html -- line 1 12{{ .Levels }} line 4 @@ -450,7 +450,7 @@ line 5 errors := herrors.UnwrapFileErrorsWithErrorContext(err) b.Assert(errors, qt.HasLen, 3) - b.Assert(errors[0].Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:2:5": "/layouts/_default/_markup/render-heading.html:2:5": execute of template failed`)) + b.Assert(errors[0].Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:2:5": "/layouts/_markup/render-heading.html:2:5": execute of template failed`)) } func TestErrorRenderHookCodeblock(t *testing.T) { @@ -470,12 +470,12 @@ bar §§§ --- layouts/index.html -- +-- layouts/home.html -- line 1 line 2 {{ .Content }} line 5 --- layouts/_default/_markup/render-codeblock-foo.html -- +-- layouts/_markup/render-codeblock-foo.html -- line 1 12{{ .Foo }} line 4 @@ -489,7 +489,7 @@ line 5 b.Assert(errors, qt.HasLen, 3) first := errors[0] - b.Assert(first.Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:7:1": "/layouts/_default/_markup/render-codeblock-foo.html:2:5": execute of template failed`)) + b.Assert(first.Error(), qt.Contains, filepath.FromSlash(`"/content/_index.md:7:1": "/layouts/_markup/render-codeblock-foo.html:2:5": execute of template failed`)) } func TestErrorInBaseTemplate(t *testing.T) { @@ -507,7 +507,7 @@ line 2 base {{ block "main" . }}empty{{ end }} line 4 base {{ block "toc" . }}empty{{ end }} --- layouts/index.html -- +-- layouts/home.html -- {{ define "main" }} line 2 index line 3 index @@ -516,7 +516,7 @@ line 4 index {{ define "toc" }} TOC: {{ partial "toc.html" . }} {{ end }} --- layouts/partials/toc.html -- +-- layouts/_partials/toc.html -- toc line 1 toc line 2 toc line 3 @@ -534,13 +534,13 @@ toc line 4 b.Assert(err.Error(), qt.Contains, `baseof.html:4:6`) }) - t.Run("index template", func(t *testing.T) { + t.Run("home template", func(t *testing.T) { files := strings.Replace(filesTemplate, "line 3 index", "1234{{ .ThisDoesNotExist \"abc\" }}", 1) b, err := TestE(t, files) b.Assert(err, qt.IsNotNil) - b.Assert(err.Error(), qt.Contains, `index.html:3:7"`) + b.Assert(err.Error(), qt.Contains, `home.html:3:7"`) }) t.Run("partial from define", func(t *testing.T) { @@ -561,9 +561,9 @@ func TestSiteBuildTimeout(t *testing.T) { filesBuilder.WriteString(` -- hugo.toml -- timeout = 5 --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .WordCount }} --- layouts/shortcodes/c.html -- +-- layouts/_shortcodes/c.html -- {{ range .Page.Site.RegularPages }} {{ .WordCount }} {{ end }} @@ -591,7 +591,7 @@ func TestErrorTemplateRuntime(t *testing.T) { files := ` -- hugo.toml -- --- layouts/index.html -- +-- layouts/home.html -- Home. {{ .ThisDoesNotExist }} ` @@ -599,7 +599,7 @@ Home. b, err := TestE(t, files) b.Assert(err, qt.Not(qt.IsNil)) - b.Assert(err.Error(), qt.Contains, filepath.FromSlash(`/layouts/index.html:2:3`)) + b.Assert(err.Error(), qt.Contains, filepath.FromSlash(`/layouts/home.html:2:3`)) b.Assert(err.Error(), qt.Contains, `can't evaluate field ThisDoesNotExist`) } diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index b32d6b2d8..d4456aebb 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -33,7 +33,7 @@ title: doc1 en title: doc1 fr slug: doc1-fr --- --- layouts/_default/single.html -- +-- layouts/single.html -- Single: {{ .Title }}|{{ .Lang }}|{{ .RelPermalink }}| ` diff --git a/hugolib/hugo_sites_multihost_test.go b/hugolib/hugo_sites_multihost_test.go index 738aa4b34..e090e03cc 100644 --- a/hugolib/hugo_sites_multihost_test.go +++ b/hugolib/hugo_sites_multihost_test.go @@ -54,9 +54,9 @@ title: "My Bundle en" My Bundle -- content/mysect/mybundle/foo.txt -- Foo --- layouts/_default/list.html -- +-- layouts/list.html -- List|{{ .Title }}|{{ .Lang }}|{{ .Permalink}}|{{ .RelPermalink }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Single|{{ .Title }}|{{ .Lang }}|{{ .Permalink}}|{{ .RelPermalink }}| {{ $foo := .Resources.Get "foo.txt" | fingerprint }} Foo: {{ $foo.Permalink }}| @@ -147,7 +147,7 @@ title: "Mybundle fr" .body { color: french; } --- layouts/_default/single.html -- +-- layouts/single.html -- {{ $data := .Resources.GetMatch "styles*" | minify }} {{ .Lang }}: {{ $data.Content}}|{{ $data.RelPermalink }}| @@ -191,7 +191,7 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA --- title: mybundle-en --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ with .Resources.Get "pixel.png" }} {{ with .Resize "2x2" }} {{ .RelPermalink }}| @@ -240,7 +240,7 @@ File 1 fr. File 1 en. -- content/en/section/mybundle/file2.txt -- File 2 en. --- layouts/_default/single.html -- +-- layouts/single.html -- {{ $files := .Resources.Match "file*" }} Files: {{ range $files }}{{ .Permalink }}|{{ end }}$ @@ -274,7 +274,7 @@ baseURL = "https://example.fr" weight = 2 -- assets/css/main.css -- body { color: red; } --- layouts/index.html -- +-- layouts/home.html -- {{ $css := resources.Get "css/main.css" | minify }} CSS: {{ $css.Permalink }}|{{ $css.RelPermalink }}| ` diff --git a/hugolib/hugo_sites_test.go b/hugolib/hugo_sites_test.go index 6b076ee71..4bdcfa7ee 100644 --- a/hugolib/hugo_sites_test.go +++ b/hugolib/hugo_sites_test.go @@ -27,7 +27,7 @@ weight = 1 weight = 2 [languages.de] weight = 3 --- layouts/index.html -- +-- layouts/home.html -- {{ $bundle := site.GetPage "bundle" }} Bundle all translations: {{ range $bundle.AllTranslations }}{{ .Lang }}|{{ end }}$ Bundle translations: {{ range $bundle.Translations }}{{ .Lang }}|{{ end }}$ diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go index f8ae8a80a..923827d2d 100644 --- a/hugolib/hugo_smoke_test.go +++ b/hugolib/hugo_smoke_test.go @@ -34,7 +34,7 @@ disableKinds = ["term", "taxonomy", "section", "page"] --- title: Page --- --- layouts/index.html -- +-- layouts/home.html -- Home: {{ .Title }} ` @@ -135,9 +135,9 @@ Rotate(language): {{ range .Rotate "language" }}{{ .Lang }}|{{ .Title }}|{{ end mytext.txt: {{ with .Resources.GetMatch "**.txt" }}{{ .Content }}|{{ .RelPermalink }}{{ end }}| mypage.md: {{ with .Resources.GetMatch "**.md" }}{{ .Content }}|{{ .RelPermalink }}{{ end }}| RenderString with shortcode: {{ .RenderString "{{< myshortcode >}}" }}| --- layouts/shortcodes/myshortcode.html -- +-- layouts/_shortcodes/myshortcode.html -- myshortcode.html --- layouts/shortcodes/myshortcode.en.html -- +-- layouts/_shortcodes/myshortcode.en.html -- myshortcode.en.html ` @@ -322,11 +322,11 @@ title: Page --- Page. --- layouts/_default/list.html -- +-- layouts/list.html -- List: {{ .Title }}|{{ .RelPermalink}}|{{ range .OutputFormats }}{{ .Name }}: {{ .RelPermalink }}|{{ end }}$ --- layouts/_default/list.xml -- +-- layouts/list.xml -- List xml: {{ .Title }}|{{ .RelPermalink}}|{{ range .OutputFormats }}{{ .Name }}: {{ .RelPermalink }}|{{ end }}$ --- layouts/_default/single.html -- +-- layouts/single.html -- Single: {{ .Title }}|{{ .RelPermalink}}|{{ range .OutputFormats }}{{ .Name }}: {{ .RelPermalink }}|{{ end }}$ ` @@ -387,7 +387,7 @@ hugo = "Rules!" [outputs] home = ["html", "json", "rss"] --- layouts/index.html -- +-- layouts/home.html -- Home: {{ .Lang}}|{{ .Kind }}|{{ .RelPermalink }}|{{ .Title }}|{{ .Content }}|Len Resources: {{ len .Resources }}|HTML Resources: {{ range .Resources }}{{ .ResourceType }}|{{ .RelPermalink }}|{{ .MediaType }} - {{ end }}| Site last mod: {{ site.Lastmod.Format "2006-02-01" }}| @@ -403,7 +403,7 @@ RenderString with shortcode: {{ .RenderString "{{% hello %}}" }}| Paginate: {{ .Paginator.PageNumber }}/{{ .Paginator.TotalPages }}| -- layouts/index.json -- Home:{{ .Lang}}|{{ .Kind }}|{{ .RelPermalink }}|{{ .Title }}|{{ .Content }}|Len Resources: {{ len .Resources }}|JSON --- layouts/_default/list.html -- +-- layouts/list.html -- List: {{ .Lang}}|{{ .Kind }}|{{ .RelPermalink }}|{{ .Title }}|{{ .Content }}|Len Resources: {{ len .Resources }}| Resources: {{ range .Resources }}{{ .ResourceType }}|{{ .RelPermalink }}|{{ .MediaType }} - {{ end }} Pages Length: {{ len .Pages }} @@ -414,7 +414,7 @@ Background: {{ .Params.background }}| Kind: {{ .Kind }} Type: {{ .Type }} Paginate: {{ .Paginator.PageNumber }}/{{ .Paginator.TotalPages }}| --- layouts/_default/single.html -- +-- layouts/single.html -- Single: {{ .Lang}}|{{ .Kind }}|{{ .RelPermalink }}|{{ .Title }}|{{ .Content }}|Len Resources: {{ len .Resources }}|Background: {{ .Params.background }}| Resources: {{ range .Resources }}{{ .ResourceType }}|{{ .RelPermalink }}|{{ .MediaType }}|{{ .Params }} - {{ end }} {{ $textResource := .Resources.GetMatch "**.txt" }} @@ -426,7 +426,7 @@ Icon fingerprinted: {{ with $textResourceFingerprinted }}{{ .Params.icon }}|{{ . NextInSection: {{ with .NextInSection }}{{ .RelPermalink }}|{{ .Title }}{{ end }}| PrevInSection: {{ with .PrevInSection }}{{ .RelPermalink }}|{{ .Title }}{{ end }}| GetTerms: {{ range .GetTerms "tags" }}name: {{ .Name }}, title: {{ .Title }}|{{ end }} --- layouts/shortcodes/hello.html -- +-- layouts/_shortcodes/hello.html -- Hello. -- content/_index.md -- --- @@ -630,7 +630,7 @@ target = "content" lang = "nn" [[module.imports]] path = "mytheme" --- layouts/index.html -- +-- layouts/home.html -- i18n s1: {{ i18n "s1" }}| i18n s2: {{ i18n "s2" }}| data s1: {{ site.Data.d1.s1 }}| @@ -716,9 +716,9 @@ mediaType = "text/csv" isPlainText = true isHTML = false --- layouts/_default/single.html -- +-- layouts/single.html -- HTML Single: {{ .Data.Pages }} --- layouts/_default/list.html -- +-- layouts/list.html -- HTML List: {{ .Data.Pages }} -- content/_index.md -- --- @@ -820,13 +820,13 @@ weight = 3 [languages.sv] title = "Svenska" weight = 4 --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }} {{ .Content }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} {{ .Content }} --- layouts/shortcodes/myshort.html -- +-- layouts/_shortcodes/myshort.html -- {{ .Inner }} ` diff --git a/hugolib/hugolib_integration_test.go b/hugolib/hugolib_integration_test.go index 250c7bcec..0293e34d1 100644 --- a/hugolib/hugolib_integration_test.go +++ b/hugolib/hugolib_integration_test.go @@ -52,9 +52,9 @@ tags: ['T1'] title: P1 tags: ['T1'] --- --- layouts/_default/single.html -- +-- layouts/single.html -- --- layouts/_default/list.html -- +-- layouts/list.html -- ` @@ -93,7 +93,7 @@ func TestRenderStringBadMarkupOpt(t *testing.T) { t.Parallel() files := ` --- layouts/index.html -- +-- layouts/home.html -- {{ $opts := dict "markup" "foo" }} {{ "something" | .RenderString $opts }} ` @@ -129,7 +129,7 @@ tags: [fiction] --- title: Films --- --- layouts/index.html -- +-- layouts/home.html -- {{ (site.GetPage "/tags").Title }} {{ (site.GetPage "/tags/fiction").Title }} {{ (site.GetPage "/books").Title }} diff --git a/hugolib/language_content_dir_test.go b/hugolib/language_content_dir_test.go index c79ab99b0..b0c1c2dbf 100644 --- a/hugolib/language_content_dir_test.go +++ b/hugolib/language_content_dir_test.go @@ -44,7 +44,7 @@ file 1 en file 2 en -- content/nn/myfiles/file1.txt -- file 1 nn --- layouts/index.html -- +-- layouts/home.html -- Title: {{ .Title }}| Len Resources: {{ len .Resources }}| {{ range $i, $e := .Resources }} diff --git a/hugolib/language_test.go b/hugolib/language_test.go index ac07d9b66..eb7f218f8 100644 --- a/hugolib/language_test.go +++ b/hugolib/language_test.go @@ -50,7 +50,7 @@ defaultContentLanguage = "%s" weight = 1 -- i18n/%s.toml -- hello.one = "Hello" --- layouts/index.html -- +-- layouts/home.html -- Hello: {{ i18n "hello" 1 }} -- content/p1.md -- `, tc.langCode, tc.langCode, tc.langCode) @@ -96,7 +96,7 @@ timeZone="UTC" weight=10 [languages.nn] weight=20 --- layouts/index.html -- +-- layouts/home.html -- FormatNumber: {{ 512.5032 | lang.FormatNumber 2 }} FormatPercent: {{ 512.5032 | lang.FormatPercent 2 }} diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go index c241c9299..418de943a 100644 --- a/hugolib/menu_test.go +++ b/hugolib/menu_test.go @@ -27,7 +27,7 @@ func TestMenusSectionPagesMenu(t *testing.T) { baseurl = "http://example.com/" title = "Section Menu" sectionPagesMenu = "sect" --- layouts/partials/menu.html -- +-- layouts/_partials/menu.html -- {{- $p := .page -}} {{- $m := .menu -}} {{ range (index $p.Site.Menus $m) -}} @@ -35,11 +35,11 @@ sectionPagesMenu = "sect" {{- if $p.IsMenuCurrent $m . }}IsMenuCurrent{{ else }}-{{ end -}}| {{- if $p.HasMenuCurrent $m . }}HasMenuCurrent{{ else }}-{{ end -}}| {{- end -}} --- layouts/_default/single.html -- +-- layouts/single.html -- Single|{{ .Title }} Menu Sect: {{ partial "menu.html" (dict "page" . "menu" "sect") }} Menu Main: {{ partial "menu.html" (dict "page" . "menu" "main") }} --- layouts/_default/list.html -- +-- layouts/list.html -- List|{{ .Title }}|{{ .Content }} -- content/sect1/p1.md -- --- @@ -143,7 +143,7 @@ func TestMenusFrontMatter(t *testing.T) { files := ` -- hugo.toml -- baseURL = "http://example.com/" --- layouts/index.html -- +-- layouts/home.html -- Main: {{ len .Site.Menus.main }} Other: {{ len .Site.Menus.other }} {{ range .Site.Menus.main }} @@ -193,7 +193,7 @@ baseURL = "https://example.com" mediaType = "text/html" path = "damp" --- layouts/index.html -- +-- layouts/home.html -- {{ range .Site.Menus.main }}{{ .Title }}|{{ .URL }}|{{ end }} -- content/_index.md -- --- @@ -235,7 +235,7 @@ func TestMenusPageSortByDate(t *testing.T) { files := ` -- hugo.toml -- baseURL = "http://example.com/" --- layouts/index.html -- +-- layouts/home.html -- {{ range .Site.Menus.main }}{{ .Title }}|Children: {{- $children := sort .Children ".Page.Date" "desc" }}{{ range $children }}{{ .Title }}|{{ end }}{{ end }} @@ -288,7 +288,7 @@ weight = 300 foo = "foo_config" key2 = "key2_config" camelCase = "camelCase_config" --- layouts/index.html -- +-- layouts/home.html -- Main: {{ len .Site.Menus.main }} {{ range .Site.Menus.main }} foo: {{ .Params.foo }} @@ -337,13 +337,13 @@ pageRef = "/blog/post3" title = "My Post 3" url = "/blog/post3" --- layouts/index.html -- +-- layouts/home.html -- Main: {{ len .Site.Menus.main }} {{ range .Site.Menus.main }} {{ .Title }}|HasMenuCurrent: {{ $.HasMenuCurrent "main" . }}|Page: {{ .Page.Path }} {{ .Title }}|IsMenuCurrent: {{ $.IsMenuCurrent "main" . }}|Page: {{ .Page.Path }} {{ end }} --- layouts/_default/single.html -- +-- layouts/single.html -- Main: {{ len .Site.Menus.main }} {{ range .Site.Menus.main }} {{ .Title }}|HasMenuCurrent: {{ $.HasMenuCurrent "main" . }}|Page: {{ .Page.Path }} @@ -444,7 +444,7 @@ weight = 1 --- title: "Test 1" --- --- layouts/_default/list.html -- +-- layouts/list.html -- {{ range site.Menus.main }} {{ .Name }}|{{ .URL }}|IsMenuCurrent = {{ $.IsMenuCurrent "main" . }}|HasMenuCurrent = {{ $.HasMenuCurrent "main" . }}| {{ range .Children }} @@ -491,7 +491,7 @@ url = "/" pre = "" post = "" weight = 1 --- layouts/index.html -- +-- layouts/home.html -- {{ range $i, $e := site.Menus.main }} Menu Item: {{ $i }}: {{ .Pre }}{{ .Name }}{{ .Post }}|{{ .URL }}| {{ end }} @@ -517,7 +517,7 @@ title = "Hugo Menu Test" name = "Posts" url = "/posts" weight = 1 --- layouts/index.html -- +-- layouts/home.html -- {{ range $i, $e := site.Menus.main }} Menu Item: {{ $i }}|{{ .URL }}| {{ end }} @@ -540,11 +540,11 @@ defaultContentLanguageInSubdir = true sectionPagesMenu = "main" [languages.en] [languages.fr] --- layouts/_default/home.html -- +-- layouts/home.html -- {{- range site.Menus.main -}} {{ .Name }} {{- end -}} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} -- content/p1.en.md -- --- @@ -592,9 +592,9 @@ menus: main --- title: p3 --- --- layouts/_default/list.html -- +-- layouts/list.html -- {{ range site.Menus.main }}{{ .Name }}{{ end }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} ` @@ -659,11 +659,11 @@ title: S2_Title title: S3_Title linkTitle: S3_LinkTitle --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Content }} --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Content }} --- layouts/_default/home.html -- +-- layouts/home.html -- {{- range site.Menus.main }} URL: {{ .URL }}| Name: {{ .Name }}| Title: {{ .Title }}| PageRef: {{ .PageRef }}| Page.Title: {{ .Page.Title }}| Page.LinkTitle: {{ .Page.LinkTitle }}| {{- end }} diff --git a/hugolib/minify_publisher_test.go b/hugolib/minify_publisher_test.go index eea267eaf..6b479d6c6 100644 --- a/hugolib/minify_publisher_test.go +++ b/hugolib/minify_publisher_test.go @@ -25,7 +25,7 @@ func TestMinifyPublisher(t *testing.T) { baseURL = "https://example.org/" [minify] minifyOutput = true --- layouts/index.html -- +-- layouts/home.html -- diff --git a/hugolib/mount_filters_test.go b/hugolib/mount_filters_test.go index 8f785aa4e..6bb4870a3 100644 --- a/hugolib/mount_filters_test.go +++ b/hugolib/mount_filters_test.go @@ -49,7 +49,7 @@ target = 'i18n' [[module.mounts]] source = 'archetypes' target = 'archetypes' --- layouts/_default/single.html -- +-- layouts/single.html -- Single page. -- content/a/b/p1.md -- --- @@ -63,7 +63,7 @@ title: Exclude b1='bval' -- data/nodata/c.toml -- c1='bval' --- layouts/partials/foo.html -- +-- layouts/_partials/foo.html -- foo -- assets/exclude.txt -- foo @@ -71,7 +71,7 @@ foo foo -- assets/js/include.js -- foo --- layouts/index.html -- +-- layouts/home.html -- Data: {{ site.Data }}:END Template: {{ templates.Exists "partials/foo.html" }}:END diff --git a/hugolib/page__fragments_test.go b/hugolib/page__fragments_test.go index c30fa829e..0e4fd1c60 100644 --- a/hugolib/page__fragments_test.go +++ b/hugolib/page__fragments_test.go @@ -43,9 +43,9 @@ outputs: ["HTML", "JSON"] --- ## Heading 1 FR --- layouts/_default/single.html -- +-- layouts/single.html -- HTML --- layouts/_default/single.json -- +-- layouts/single.json -- {{ $secondSite := index .Sites 1 }} {{ $p1 := $secondSite.GetPage "p1" }} ToC: {{ $p1.TableOfContents }} @@ -89,9 +89,9 @@ title: "P2" ### Heading P2 1 ### Heading P2 2 --- layouts/shortcodes/include.html -- +-- layouts/_shortcodes/include.html -- {{ with site.GetPage (.Get 0) }}{{ .RawContent }}{{ end }} --- layouts/_default/single.html -- +-- layouts/single.html -- Fragments: {{ .Fragments.Identifiers }}| diff --git a/hugolib/page__meta_test.go b/hugolib/page__meta_test.go index 58d29464d..8447c0c7e 100644 --- a/hugolib/page__meta_test.go +++ b/hugolib/page__meta_test.go @@ -35,9 +35,9 @@ tag = 'tags' title: page-1 tags: 'tag-a' --- --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} ` @@ -73,7 +73,7 @@ weight = 2 title: "p2" draft: true --- --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Title }} ` b := Test(t, files) diff --git a/hugolib/page_permalink_test.go b/hugolib/page_permalink_test.go index edb03f4ee..66281b5b5 100644 --- a/hugolib/page_permalink_test.go +++ b/hugolib/page_permalink_test.go @@ -117,9 +117,9 @@ contentDir = "content/en" [Languages.nn] weight = 20 contentDir = "content/nn" --- layouts/_default/single.html -- +-- layouts/single.html -- Single: {{ .Title }}|Hello|{{ .Lang }}|RelPermalink: {{ .RelPermalink }}|Permalink: {{ .Permalink }}| --- layouts/_default/list.html -- +-- layouts/list.html -- List Page 1|{{ .Title }}|Hello|{{ .Permalink }}| -- content/en/blog/page1.md -- --- diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 0f7ac65e6..56bb40011 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -454,7 +454,7 @@ tags: ["a", "c"] categories: ["c", "e"] --- p2 --- layouts/_default/list.html -- +-- layouts/list.html -- {{ .Title }}|Date: {{ .Date.Format "2006-01-02" }}|Lastmod: {{ .Lastmod.Format "2006-01-02" }}| ` @@ -662,7 +662,7 @@ title: "basic" --- title: "empty" --- --- layouts/_default/single.html -- +-- layouts/single.html -- |{{ .RawContent }}| ` @@ -720,7 +720,7 @@ title: Simple summary: "Front **matter** summary" --- Simple Page --- layouts/_default/single.html -- +-- layouts/single.html -- Summary: {{ .Summary }}|Truncated: {{ .Truncated }}| `).AssertFileContent("public/simple/index.html", "Summary: Front matter summary|", "Truncated: false") @@ -737,7 +737,7 @@ title: Simple This is **summary**. This is **content**. --- layouts/_default/single.html -- +-- layouts/single.html -- Summary: {{ .Summary }}|Truncated: {{ .Truncated }}| Content: {{ .Content }}| @@ -763,7 +763,7 @@ This is summary.
This is content.
--- layouts/_default/single.html -- +-- layouts/single.html -- Summary: {{ .Summary }}|Truncated: {{ .Truncated }}| Content: {{ .Content }}| @@ -785,7 +785,7 @@ This is *even more summary**. This is **more summary**. This is **content**. --- layouts/_default/single.html -- +-- layouts/single.html -- Summary: {{ .Summary }}|Truncated: {{ .Truncated }}| Content: {{ .Content }}| @@ -841,14 +841,14 @@ contentDir = 'content/en' [outputs] home = ["HTML", "JSON"] --- layouts/index.html -- +-- layouts/home.html -- {{- range .Site.Home.Translations -}}

{{- .RenderString "foo" -}}

{{- end -}} {{- range .Site.Home.AllTranslations -}}

{{- .RenderString "bar" -}}

{{- end -}} --- layouts/_default/single.html -- +-- layouts/single.html -- {{ .Content }} -- layouts/index.json -- {"Title": "My Site"} @@ -921,7 +921,7 @@ defaultContentLanguage = "en"
  • Len: {{ .Len }}
  • {{ end }} --- layouts/_default/baseof.html -- +-- layouts/baseof.html -- @@ -929,7 +929,7 @@ defaultContentLanguage = "en" --- layouts/_default/home.html -- +-- layouts/home.html -- {{ define "main" }}

    Translations