testing: Port integration tests to new templates structure

As introduced in  v0.146.0. Keep some legecy test to preserve backwards compatibility.
This commit is contained in:
Bjørn Erik Pedersen
2025-11-27 10:42:29 +01:00
parent 8be30ef2cb
commit b9b304a126
110 changed files with 1242 additions and 1225 deletions

View File

@@ -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" }}

View File

@@ -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"

View File

@@ -35,7 +35,7 @@ baseURL = 'https://en.example.org/'
---
title: home
---
-- layouts/index.html --
-- layouts/home.html --
multilingual={{ hugo.IsMultilingual }}
multihost={{ hugo.IsMultihost }}
`

View File

@@ -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)

View File

@@ -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
`

View File

@@ -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" }}

View File

@@ -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 --
---

View File

@@ -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 --
---

View File

@@ -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 --
---

View File

@@ -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)

View File

@@ -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
<p>b</p>
-- content/p1/c.html --
<p>c</p>
-- layouts/_default/single.html --
-- layouts/single.html --
Path: {{ .Path }}|{{.Kind }}
|{{ (.Resources.Get "a.html").RelPermalink -}}
|{{ (.Resources.Get "b.html").RelPermalink -}}

View File

@@ -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="><script>alert()</script>" 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 --
---

View File

@@ -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 }}|
`

View File

@@ -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 --
---

View File

@@ -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)

View File

@@ -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)

View File

@@ -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,

View File

@@ -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 }}

View File

@@ -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 }}
`

View File

@@ -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 --
<body>
<script>=;</script>
</body>
@@ -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`)
}

View File

@@ -33,7 +33,7 @@ title: doc1 en
title: doc1 fr
slug: doc1-fr
---
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Lang }}|{{ .RelPermalink }}|
`

View File

@@ -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 }}|
`

View File

@@ -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 }}$

View File

@@ -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 }}
`

View File

@@ -52,9 +52,9 @@ tags: ['T1']
title: P1
tags: ['T1']
---
-- layouts/_default/single.html --
-- layouts/single.html --
<ul>{{ range .AllTranslations }}<li>{{ .Title }}-{{ .Lang }}</li>{{ end }}</ul>
-- layouts/_default/list.html --
-- layouts/list.html --
<ul>{{ range .AllTranslations }}<li>{{ .Title }}-{{ .Lang }}</li>{{ end }}</ul>
`
@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 }}

View File

@@ -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 = "<span>"
post = "</span>"
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 -}}
<a href="{{ .URL }}">{{ .Name }}</a>
{{- 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 }}<a href="{{ .URL }}">{{ .Name }}</a>{{ 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 }}

View File

@@ -25,7 +25,7 @@ func TestMinifyPublisher(t *testing.T) {
baseURL = "https://example.org/"
[minify]
minifyOutput = true
-- layouts/index.html --
-- layouts/home.html --
<!DOCTYPE html>
<html lang="en">
<head>

View File

@@ -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

View File

@@ -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 }}|

View File

@@ -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)

View File

@@ -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 --
---

View File

@@ -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 <strong>matter</strong> summary|", "Truncated: false")
@@ -737,7 +737,7 @@ title: Simple
This is **summary**.
<!--more-->
This is **content**.
-- layouts/_default/single.html --
-- layouts/single.html --
Summary: {{ .Summary }}|Truncated: {{ .Truncated }}|
Content: {{ .Content }}|
@@ -763,7 +763,7 @@ This is <b>summary</b>.
<div>
This is <b>content</b>.
</div>
-- 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 -}}
<p>{{- .RenderString "foo" -}}</p>
{{- end -}}
{{- range .Site.Home.AllTranslations -}}
<p>{{- .RenderString "bar" -}}</p>
{{- end -}}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/index.json --
{"Title": "My Site"}
@@ -921,7 +921,7 @@ defaultContentLanguage = "en"
<li>Len: {{ .Len }}</li>
{{ end }}
</ul>
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
<html>
<body>
@@ -929,7 +929,7 @@ defaultContentLanguage = "en"
</body>
</html>
-- layouts/_default/home.html --
-- layouts/home.html --
{{ define "main" }}
<h2>Translations</h2>
<ul>
@@ -1300,7 +1300,7 @@ title: "p1 en"
translationkey: "adfasdf"
title: "p1 nn"
---
-- layouts/_default/single.html --
-- layouts/single.html --
Title: {{ .Title }}|TranslationKey: {{ .TranslationKey }}|
Translations: {{ range .Translations }}{{ .Language.Lang }}|{{ end }}|
AllTranslations: {{ range .AllTranslations }}{{ .Language.Lang }}|{{ end }}|
@@ -1334,9 +1334,9 @@ weight = 1
weight = 2
[taxonomies]
category = 'categories'
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .IsTranslated }}|{{ range .Translations }}{{ .RelPermalink }}|{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|
-- content/p1.en.md --
---
@@ -1393,7 +1393,7 @@ title: "mybundle nn"
---
-- content/sect/mybundle_nn/f2.nn.txt --
f2.nn
-- layouts/_default/single.html --
-- layouts/single.html --
Title: {{ .Title }}|TranslationKey: {{ .TranslationKey }}|
Resources: {{ range .Resources }}{{ .RelPermalink }}|{{ .Content }}|{{ end }}|
@@ -1515,9 +1515,9 @@ Summary.
# more
Content.
-- layouts/shortcodes/sc.html --
-- layouts/_shortcodes/sc.html --
a shortcode
-- layouts/_default/single.html --
-- layouts/single.html --
SUMMARY:{{ .Summary }}:END
--------------------------
CONTENT:{{ .Content }}
@@ -1561,7 +1561,7 @@ func TestHomePageWithNoTitle(t *testing.T) {
-- hugo.toml --
baseURL = "http://example.com/"
title = "Site Title"
-- layouts/index.html --
-- layouts/home.html --
Title|{{ with .Title }}{{ . }}{{ end }}|
-- content/_index.md --
---
@@ -1700,7 +1700,7 @@ title: "Pag.E4"
slug: "PaGe4"
---
p4.
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title}}|{{ .RelPermalink }}|{{ .Path }}|
`
b := Test(t, files)
@@ -1716,13 +1716,13 @@ func TestScratch(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ .Scratch.Set "b" "bv" }}
B: {{ .Scratch.Get "b" }}
-- layouts/shortcodes/scratch.html --
-- layouts/_shortcodes/scratch.html --
{{ .Scratch.Set "c" "cv" }}
C: {{ .Scratch.Get "c" }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/scratchme.md --
---
@@ -1753,7 +1753,7 @@ func TestScratchAliasToStore(t *testing.T) {
-- hugo.toml --
disableKinds = ["taxonomy", "term", "page", "section"]
disableLiveReload = true
-- layouts/index.html --
-- layouts/home.html --
{{ .Scratch.Set "a" "b" }}
{{ .Store.Set "c" "d" }}
.Scratch eq .Store: {{ eq .Scratch .Store }}
@@ -1781,7 +1781,7 @@ baseURL = "https://example.org"
[params]
[params.author]
name = "Kurt Vonnegut"
-- layouts/index.html --
-- layouts/home.html --
{{ $withParam := .Site.GetPage "withparam" }}
{{ $noParam := .Site.GetPage "noparam" }}
@@ -1868,13 +1868,13 @@ defaultMarkdownHandler="goldmark"
unsafe = false
[markup.highlight]
noClasses=false
-- layouts/_default/single.html --
-- layouts/single.html --
Title: {{ .Title }}
ToC: {{ .TableOfContents }}
Content: {{ .Content }}
-- layouts/shortcodes/t.html --
-- layouts/_shortcodes/t.html --
T-SHORT
-- layouts/shortcodes/s.html --
-- layouts/_shortcodes/s.html --
## Code
{{ .Inner }}
-- content/page.md --
@@ -1939,7 +1939,7 @@ func TestRenderWithoutArgument(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ .Render }}
`
@@ -1966,10 +1966,10 @@ disableLiveReload = true
title: "Home"
---
{{< s >}}
-- layouts/shortcodes/s.html --
-- layouts/_shortcodes/s.html --
{{ if not (.Store.Get "Shortcode") }}{{ .Store.Set "Shortcode" (printf "sh-%s" $.Page.Title) }}{{ end }}
Shortcode: {{ .Store.Get "Shortcode" }}|
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
{{ if not (.Store.Get "Page") }}{{ .Store.Set "Page" (printf "p-%s" $.Title) }}{{ end }}
{{ if not (hugo.Store.Get "Hugo") }}{{ hugo.Store.Set "Hugo" (printf "h-%s" $.Title) }}{{ end }}

View File

@@ -64,7 +64,7 @@ disableKinds = ["taxonomy", "term"]
---
title: "Root"
---
-- layouts/_default/single.html --
-- layouts/single.html --
Basic: {{ .Title }}|{{ .Kind }}|{{ .BundleType }}|{{ .RelPermalink }}|
Tree: Section: {{ .Section }}|CurrentSection: {{ .CurrentSection.RelPermalink }}|Parent: {{ .Parent.RelPermalink }}|FirstSection: {{ .FirstSection.RelPermalink }}
`
@@ -95,9 +95,9 @@ P1 content.
{{< myShort >}}
-- layouts/_default/single.html --
-- layouts/single.html --
Bundled page: {{ .RelPermalink}}|{{ with .Resources.Get "p1.md" }}Title: {{ .Title }}|Content: {{ .Content }}{{ end }}|
-- layouts/shortcodes/myShort.html --
-- layouts/_shortcodes/myShort.html --
MyShort.
`
@@ -133,14 +133,14 @@ P1.
{{< hello >}}
-- layouts/shortcodes/hello.html --
-- layouts/_shortcodes/hello.html --
Hello HTML.
-- layouts/_default/single.html --
-- layouts/single.html --
Basic: {{ .Title }}|{{ .Kind }}|{{ .BundleType }}|{{ .RelPermalink }}|
Resources: {{ range .Resources }}RelPermalink: {{ .RelPermalink }}|Content: {{ .Content }}|{{ end }}|
-- layouts/shortcodes/hello.cpath --
-- layouts/_shortcodes/hello.cpath --
Hello CPATH.
-- layouts/_default/single.cpath --
-- layouts/single.cpath --
Basic: {{ .Title }}|{{ .Kind }}|{{ .BundleType }}|{{ .RelPermalink }}|
Resources: {{ range .Resources }}RelPermalink: {{ .RelPermalink }}|Content: {{ .Content }}|{{ end }}|
`
@@ -185,7 +185,7 @@ F1
F2
-- content/mybundle/f2.nn.txt --
F2 nn.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .RelPermalink }}|{{ .Lang }}|
Resources: {{ range .Resources }}RelPermalink: {{ .RelPermalink }}|Content: {{ .Content }}|{{ end }}|
@@ -229,11 +229,11 @@ title: "My Sect Nn"
title: "P1nn"
---
P1nn
-- layouts/index.html --
-- layouts/home.html --
Len RegularPages: {{ len .Site.RegularPages }}|RegularPages: {{ range site.RegularPages }}{{ .RelPermalink }}: {{ .Title }}|{{ end }}|
Len Pages: {{ len .Site.Pages }}|
Len Sites: {{ len .Site.Sites }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .Content }}|{{ .Lang }}|
`
@@ -289,11 +289,11 @@ title: "My Sect Nn"
title: "P1nn"
---
P1nn
-- layouts/index.html --
-- layouts/home.html --
Len RegularPages: {{ len .Site.RegularPages }}|RegularPages: {{ range site.RegularPages }}{{ .RelPermalink }}: {{ .Title }}|{{ end }}|
Len Pages: {{ len .Site.Pages }}|
Len Sites: {{ len .Site.Sites }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .Content }}|{{ .Lang }}|
`
@@ -325,7 +325,7 @@ title: P1
title: My Headless Bundle2
headless: true
---
-- layouts/index.html --
-- layouts/home.html --
{{ $headless1 := .Site.GetPage "headless/h1" }}
{{ $headless2 := .Site.GetPage "headless/h2" }}
@@ -395,9 +395,9 @@ Date: 2018-02-01
---
Single content.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .Content }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}|{{ .Content }}
`
b := Test(t, files)
@@ -458,10 +458,10 @@ F1 en.
F2 en.
-- content/mybundle/f2.nn.txt --
F2 nn.
-- layouts/shortcodes/getresource.html --
-- layouts/_shortcodes/getresource.html --
{{ $r := .Page.Resources.Get (.Get 0)}}
Resource: {{ (.Get 0) }}|{{ with $r }}{{ .RelPermalink }}|{{ .Content }}|{{ else }}Not found.{{ end}}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .RelPermalink }}|{{ .Lang }}|{{ .Content }}|
`
b := Test(t, files)
@@ -507,7 +507,7 @@ title: Page
---
-- content/mybundle/data.json --
MyData
-- layouts/_default/single.html --
-- layouts/single.html --
{{ range .Resources }}
{{ .ResourceType }}|{{ .Title }}|
{{ end }}
@@ -549,7 +549,7 @@ title: "Bundled page en"
title: "Bundled page nn"
---
-- layouts/_default/single.html --
-- layouts/single.html --
Bundled page: {{ .RelPermalink}}|Len resources: {{ len .Resources }}|
@@ -570,7 +570,7 @@ func TestBundleIndexInSubFolder(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.com"
-- layouts/_default/single.html --
-- layouts/single.html --
{{ range .Resources }}
{{ .ResourceType }}|{{ .Title }}|
{{ end }}
@@ -616,9 +616,9 @@ title: Home
![Alt text](image.jpg)
-- content/data.json --
DATA
-- layouts/index.html --
-- layouts/home.html --
Title: {{ .Title }}|First Resource: {{ index .Resources 0 }}|Content: {{ .Content }}
-- layouts/_default/_markup/render-image.html --
-- layouts/_markup/render-image.html --
Hook Len Page Resources {{ len .Page.Resources }}
`
b := Test(t, files)
@@ -675,9 +675,9 @@ title: "HTML with commented out frontmatter"
---
-->
<html>hello</html>
-- layouts/index.html --
-- layouts/home.html --
{{ range site.RegularPages }}{{ .RelPermalink }}|{{ end }}$
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .RelPermalink }}Resources: {{ range .Resources }}{{ .Name }}|{{ end }}$
`
@@ -731,9 +731,9 @@ Section data TXT.
-- content/mysection/p2.md --
-- content/mysection/p2.html --
-- content/mysection/foo/p2.md --
-- layouts/_default/single.html --
-- layouts/single.html --
Single:{{ .Title }}|{{ .Path }}|File LogicalName: {{ with .File }}{{ .LogicalName }}{{ end }}||{{ .RelPermalink }}|{{ .Kind }}|Resources: {{ range .Resources}}{{ .Name }}: {{ .Content }}|{{ end }}$
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .Path }}|File LogicalName: {{ with .File }}{{ .LogicalName }}{{ end }}|{{ .RelPermalink }}|{{ .Kind }}|Resources: {{ range .Resources}}{{ .Name }}: {{ .Content }}|{{ end }}$
RegularPages: {{ range .RegularPages }}{{ .RelPermalink }}|File LogicalName: {{ with .File }}{{ .LogicalName }}|{{ end }}{{ end }}$
`
@@ -754,7 +754,7 @@ baseURL = "https://example.com"
-- content/mybundle/index.md --
-- content/mybundle/f1.en.txt --
F1.
-- layouts/_default/single.html --
-- layouts/single.html --
GetMatch: {{ with .Resources.GetMatch "f1.en.*" }}{{ .Name }}: {{ .Content }}|{{ end }}
Match: {{ range .Resources.Match "f1.En.*" }}{{ .Name }}: {{ .Content }}|{{ end }}
`
@@ -781,7 +781,7 @@ draft: true
---
-- content/mybundle/f1.en.txt --
F1.
-- layouts/_default/single.html --
-- layouts/single.html --
GetMatch: {{ with .Resources.GetMatch "f1.*" }}{{ .Name }}: {{ .Content }}|{{ end }}$
`
@@ -812,9 +812,9 @@ title: p1
---
p1.txt
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}|
`

View File

@@ -54,9 +54,9 @@ func TestGetPage(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}
-- content/_index.md --
@@ -321,7 +321,7 @@ disableKinds = ["taxonomy", "term"]
---
title: "Mysect Index"
---
-- layouts/index.html --
-- layouts/home.html --
GetPage 1: {{ with site.GetPage "mysect/index/index.md" }}{{ .Title }}|{{ .RelPermalink }}|{{ .Path }}{{ end }}|
GetPage 2: {{ with site.GetPage "mysect/index" }}{{ .Title }}|{{ .RelPermalink }}|{{ .Path }}{{ end }}|
`
@@ -358,7 +358,7 @@ draft: false
---title: members who
draft: true
---
-- layouts/_default/list.html --
-- layouts/list.html --
{{ with .GetPage "members.md" }}
Members: {{ .Title }}
{{ else }}
@@ -382,7 +382,7 @@ title: p1
---
-- p1/p1.xyz --
xyz.
-- layouts/index.html --
-- layouts/home.html --
Home. {{ with .Page.GetPage "p1.xyz" }}{{ else }}OK 1{{ end }} {{ with .Site.GetPage "p1.xyz" }}{{ else }}OK 2{{ end }}
`
@@ -406,9 +406,9 @@ layout: p1
title: p2
layout: p2
---
-- layouts/_default/p1.html --
-- layouts/p1.html --
{{ (.GetPage "p2.md").Title }}|
-- layouts/_default/p2.html --
-- layouts/p2.html --
{{ (.GetPage "p1").Title }}|
`
@@ -430,7 +430,7 @@ disableKinds = ['rss','section','sitemap']
title: p1
tags: [news]
---
-- layouts/index.html --
-- layouts/home.html --
/tags/news: {{ with .Site.GetPage "/tags/news" }}{{ .Title }}{{ end }}|
news: {{ with .Site.GetPage "news" }}{{ .Title }}{{ end }}|
/news: {{ with .Site.GetPage "/news" }}{{ .Title }}{{ end }}|
@@ -457,7 +457,7 @@ title: p1
---
title: p2
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ with .GetPage "p2" }}
OK: {{ .LinkTitle }}
{{ else }}
@@ -493,14 +493,14 @@ title: p3
---
title: p2_root
---
-- layouts/index.html --
-- layouts/home.html --
/s1: {{ with .GetPage "/s1" }}{{ .Title }}{{ end }}|
/s1/: {{ with .GetPage "/s1/" }}{{ .Title }}{{ end }}|
/s1/p2.md: {{ with .GetPage "/s1/p2.md" }}{{ .Title }}{{ end }}|
/s1/p2: {{ with .GetPage "/s1/p2" }}{{ .Title }}{{ end }}|
/s1/p1/index.md: {{ with .GetPage "/s1/p1/index.md" }}{{ .Title }}{{ end }}|
/s1/p1: {{ with .GetPage "/s1/p1" }}{{ .Title }}{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
../p2: {{ with .GetPage "../p2" }}{{ .Title }}{{ end }}|
../p2.md: {{ with .GetPage "../p2.md" }}{{ .Title }}{{ end }}|
p1/index.md: {{ with .GetPage "p1/index.md" }}{{ .Title }}{{ end }}|
@@ -570,16 +570,16 @@ title: b2
---
title: d1
---
-- layouts/shortcodes/ref.html --
-- layouts/_shortcodes/ref.html --
{{ $ref := .Get 0 }}
.Page.GetPage({{ $ref }}).Title: {{ with .Page.GetPage $ref }}{{ .Title }}{{ end }}|
-- layouts/index.html --
-- layouts/home.html --
Home.
/blog/b1.md: {{ with .GetPage "/blog/b1.md" }}{{ .Title }}{{ end }}|
/blog/b2/index.md: {{ with .GetPage "/blog/b2/index.md" }}{{ .Title }}{{ end }}|
/docs/d1.md: {{ with .GetPage "/docs/d1.md" }}{{ .Title }}{{ end }}|
/README.md: {{ with .GetPage "/README.md" }}{{ .Title }}{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
/README.md: {{ with .GetPage "/README.md" }}{{ .Title }}{{ end }}|
{{ .Content }}
@@ -642,7 +642,7 @@ title: about1
---
title: about1en
---
-- layouts/index.html --
-- layouts/home.html --
{{ with site.GetPage "docs/1" }}
Docs p1: {{ .Title }}
{{ else }}
@@ -708,7 +708,7 @@ title: docs_sect2_ps2
---
title: news1
---
-- layouts/index.html --
-- layouts/home.html --
{{ $sect1 := site.GetPage "sect1" }}
Sect1 RegularPagesRecursive: {{ range $sect1.RegularPagesRecursive }}{{ .Kind }}:{{ .RelPermalink}}|{{ end }}|End.
@@ -733,7 +733,7 @@ func TestRegularPagesRecursiveHome(t *testing.T) {
-- hugo.toml --
-- content/p1.md --
-- content/post/p2.md --
-- layouts/index.html --
-- layouts/home.html --
RegularPagesRecursive: {{ range .RegularPagesRecursive }}{{ .Kind }}:{{ .RelPermalink}}|{{ end }}|End.
`
@@ -764,7 +764,7 @@ draft: true
-- content/s1-foo/s2/p3.md --
-- content/s1-foo/s2-foo/_index.md --
-- content/s1-foo/s2-foo/p4.md --
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .RelPermalink }}: Pages: {{ range .Pages }}{{ .RelPermalink }}|{{ end }}$
`
@@ -782,12 +782,12 @@ func TestGetPageContentAdapterBaseIssue12561(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
Test A: {{ (site.GetPage "/s1/p1").Title }}
Test B: {{ (site.GetPage "p1").Title }}
Test C: {{ (site.GetPage "/s2/p2").Title }}
Test D: {{ (site.GetPage "p2").Title }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
-- content/s1/p1.md --
---

View File

@@ -109,9 +109,9 @@ Pages2: {{ range $i, $p := $pages2 }}{{ add $i 1 }}: {{ .Title }} {{ .Language.L
{{ $nil := resources.Get "asdfasdfasdf" }}
Pages3: {{ $frSite.RegularPages | lang.Merge $nil }}
Pages4: {{ $nil | lang.Merge $frSite.RegularPages }}
-- layouts/shortcodes/shortcode.html --
-- layouts/_shortcodes/shortcode.html --
MyShort
-- layouts/shortcodes/lingo.html --
-- layouts/_shortcodes/lingo.html --
MyLingo
`
b := Test(t, files)
@@ -187,9 +187,9 @@ date: "2018-02-28"
// Add shortcode templates
b.WriteString(`
-- layouts/shortcodes/shortcode.html --
-- layouts/_shortcodes/shortcode.html --
MyShort
-- layouts/shortcodes/lingo.html --
-- layouts/_shortcodes/lingo.html --
MyLingo
`)

View File

@@ -36,13 +36,13 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA
-- assets/mydata.yaml --
p1: "p1"
draft: false
-- layouts/partials/get-value.html --
-- layouts/_partials/get-value.html --
{{ $val := "p1" }}
{{ return $val }}
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Baseof:
{{ block "main" . }}{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
Single: {{ .Title }}|{{ .Content }}|Params: {{ .Params.param1 }}|Path: {{ .Path }}|
Dates: Date: {{ .Date.Format "2006-01-02" }}|Lastmod: {{ .Lastmod.Format "2006-01-02" }}|PublishDate: {{ .PublishDate.Format "2006-01-02" }}|ExpiryDate: {{ .ExpiryDate.Format "2006-01-02" }}|
@@ -55,7 +55,7 @@ Resized Featured Image: {{ .RelPermalink }}|{{ .Width }}|
{{ end}}
{{ end }}
{{ end }}
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .Content }}|
RegularPagesRecursive: {{ range .RegularPagesRecursive }}{{ .Title }}:{{ .Path }}|{{ end }}$
Sections: {{ range .Sections }}{{ .Title }}:{{ .Path }}|{{ end }}$
@@ -140,7 +140,7 @@ baseURL = "https://example.com"
[security]
[security.exec]
allow = ['asciidoctor', 'pandoc','rst2html', 'python']
-- layouts/_default/single.html --
-- layouts/single.html --
|Content: {{ .Content }}|Title: {{ .Title }}|Path: {{ .Path }}|
-- content/docs/_content.gotmpl --
{{ $.AddPage (dict "path" "asciidoc" "content" (dict "value" "Mark my words, #automation is essential#." "mediaType" "text/asciidoc" )) }}
@@ -239,7 +239,7 @@ func TestPagesFromGoTmplEditDataResource(t *testing.T) {
func TestPagesFromGoTmplEditPartial(t *testing.T) {
t.Parallel()
b := hugolib.TestRunning(t, filesPagesFromDataTempleBasic)
b.EditFileReplaceAll("layouts/partials/get-value.html", "p1", "p1edited").Build()
b.EditFileReplaceAll("layouts/_partials/get-value.html", "p1", "p1edited").Build()
b.AssertFileContent("public/docs/p1/index.html", "Single: p1:p1edited|")
b.AssertFileContent("public/docs/index.html", "p1edited")
}
@@ -370,7 +370,7 @@ title = "Title"
weight = 2
title = "Titre"
disabled = DISABLE
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
-- content/docs/_content.gotmpl --
{{ $.AddPage (dict "kind" "page" "path" "p1" "title" "Title" ) }}
@@ -395,7 +395,7 @@ func TestPagesFromGoTmplDefaultPageSort(t *testing.T) {
files := `
-- hugo.toml --
defaultContentLanguage = "en"
-- layouts/index.html --
-- layouts/home.html --
{{ range site.RegularPages }}{{ .RelPermalink }}|{{ end}}
-- content/_content.gotmpl --
{{ $.AddPage (dict "kind" "page" "path" "docs/_p22" "title" "A" ) }}
@@ -464,7 +464,7 @@ func TestPagesFromGoTmplMarkdownify(t *testing.T) {
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
-- layouts/_default/single.html --
-- layouts/single.html --
|Content: {{ .Content }}|Title: {{ .Title }}|Path: {{ .Path }}|
-- content/docs/_content.gotmpl --
{{ $content := "**Hello World**" | markdownify }}
@@ -485,7 +485,7 @@ func TestPagesFromGoTmplResourceWithoutExtensionWithMediaTypeProvided(t *testing
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
-- layouts/_default/single.html --
-- layouts/single.html --
|Content: {{ .Content }}|Title: {{ .Title }}|Path: {{ .Path }}|
{{ range .Resources }}
|RelPermalink: {{ .RelPermalink }}|Name: {{ .Name }}|Title: {{ .Title }}|Params: {{ .Params }}|MediaType: {{ .MediaType }}|
@@ -507,7 +507,7 @@ func TestPagesFromGoTmplCascade(t *testing.T) {
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
-- layouts/_default/single.html --
-- layouts/single.html --
|Content: {{ .Content }}|Title: {{ .Title }}|Path: {{ .Path }}|Params: {{ .Params }}|
-- content/_content.gotmpl --
{{ $cascade := dict "params" (dict "cascadeparam1" "cascadeparam1value" ) }}
@@ -527,7 +527,7 @@ func TestPagesFromGoBuildOptions(t *testing.T) {
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap"]
baseURL = "https://example.com"
-- layouts/_default/single.html --
-- layouts/single.html --
|Content: {{ .Content }}|Title: {{ .Title }}|Path: {{ .Path }}|Params: {{ .Params }}|
-- content/_content.gotmpl --
{{ $.AddPage (dict "path" "docs/p1" "content" (dict "value" "**Hello World**" "mediaType" "text/markdown" )) }}
@@ -550,7 +550,7 @@ func TestPagesFromGoPathsWithDotsIssue12493(t *testing.T) {
disableKinds = ['home','section','rss','sitemap','taxonomy','term']
-- content/_content.gotmpl --
{{ .AddPage (dict "path" "s-1.2.3/p-4.5.6" "title" "p-4.5.6") }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
`
@@ -568,7 +568,7 @@ disableKinds = ['home','section','rss','sitemap','taxonomy','term']
-- content/_content.gotmpl --
{{ .AddPage (dict "path" "p1" "title" "p1" "params" (dict "paraM1" "param1v" )) }}
{{ .AddResource (dict "path" "p1/data1.yaml" "content" (dict "value" "data1" ) "params" (dict "paraM1" "param1v" )) }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .Params.paraM1 }}
{{ range .Resources }}
{{ .Name }}|{{ .Params.paraM1 }}
@@ -595,9 +595,9 @@ disableKinds = ['home','rss','section','sitemap','taxonomy','term']
{{ $content := dict "mediaType" "text/html" "value" "{{< sc >}}" }}
{{ .AddPage (dict "content" $content "path" "b") }}
-- layouts/_default/single.html --
-- layouts/single.html --
|{{ .Content }}|
-- layouts/shortcodes/sc.html --
-- layouts/_shortcodes/sc.html --
foo
{{- /**/ -}}
`
@@ -623,7 +623,7 @@ name = "Footer"
-- content/_content.gotmpl --
{{ .AddPage (dict "path" "p1" "title" "p1" "menus" "main" ) }}
{{ .AddPage (dict "path" "p2" "title" "p2" "menus" (slice "main" "footer")) }}
-- layouts/index.html --
-- layouts/home.html --
Main: {{ range index site.Menus.main }}{{ .Name }}|{{ end }}|
Footer: {{ range index site.Menus.footer }}{{ .Name }}|{{ end }}|
@@ -655,7 +655,7 @@ disableKinds = ['rss','section','sitemap','taxonomy','term']
{{ $menus := dict "m1" $menu1 "m2" $menu2 }}
{{ .AddPage (dict "path" "p1" "title" "p1" "menus" $menus ) }}
-- layouts/index.html --
-- layouts/home.html --
Menus: {{ range $k, $v := site.Menus }}{{ $k }}|{{ end }}
`
@@ -679,7 +679,7 @@ unsafe = true
"path" "p1"
}}
{{ .AddPage $page }}
-- layouts/_default/single.html --
-- layouts/single.html --
summary: {{ .Summary }}|content: {{ .Content}}
`
@@ -709,9 +709,9 @@ tags: ["mytag"]
-- content/tags/_content.gotmpl --
{{ .AddPage (dict "path" "mothertag" "title" "My title" "kind" "term") }}
--
-- layouts/_default/taxonomy.html --
-- layouts/taxonomy.html --
Terms: {{ range .Data.Terms.ByCount }}{{ .Name }}: {{ .Count }}|{{ end }}§s
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
`

View File

@@ -58,7 +58,7 @@ Content.
}
files += `
-- layouts/index.html --
-- layouts/home.html --
{{ $pag := $.Paginator }}
Total: {{ $pag.TotalPages }}
First: {{ $pag.First.URL }}
@@ -179,7 +179,7 @@ func TestPaginatorEmptyPageGroups(t *testing.T) {
baseURL = "https://example.com/"
-- content/p1.md --
-- content/p2.md --
-- layouts/index.html --
-- layouts/home.html --
{{ $empty := site.RegularPages | complement site.RegularPages }}
Len: {{ len $empty }}: Type: {{ printf "%T" $empty }}
{{ $pgs := $empty.GroupByPublishDate "January 2006" }}
@@ -197,7 +197,7 @@ func TestPaginatorNodePagesOnly(t *testing.T) {
[pagination]
pagerSize = 1
-- content/p1.md --
-- layouts/_default/single.html --
-- layouts/single.html --
Paginator: {{ .Paginator }}
`
b, err := TestE(t, files)
@@ -209,7 +209,7 @@ func TestNilPointerErrorMessage(t *testing.T) {
files := `
-- hugo.toml --
-- content/p1.md --
-- layouts/_default/single.html --
-- layouts/single.html --
Home Filename: {{ site.Home.File.Filename }}
`
b, err := TestE(t, files)

View File

@@ -44,7 +44,7 @@ params:
a: "p1-a"
summary: "params.summary"
---
-- layouts/_default/single.html --
-- layouts/single.html --
Params: {{ range $k, $v := .Params }}{{ $k }}: {{ $v }}|{{ end }}$
Summary: {{ .Summary }}|
`
@@ -69,7 +69,7 @@ baseURL = "https://example.org/"
title: "P1"
build: "foo"
---
-- layouts/_default/single.html --
-- layouts/single.html --
Params: {{ range $k, $v := .Params }}{{ $k }}: {{ $v }}|{{ end }}$
`
b, err := TestE(t, files)

View File

@@ -80,21 +80,21 @@ Assets My Text.
Assets My Shortcode Text.
-- assets/myothertext.txt --
Assets My Other Text.
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}$
Resources: {{ range $i, $e := .Resources }}{{ $i }}:{{ .RelPermalink }}|{{ .Content }}|{{ end }}$
Len Resources: {{ len .Resources }}|
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .Content }}$
Len Resources: {{ len .Resources }}|
Resources: {{ range $i, $e := .Resources }}{{ $i }}:{{ .RelPermalink }}|{{ .Content }}|{{ end }}$
-- layouts/shortcodes/foo.html --
-- layouts/_shortcodes/foo.html --
Foo.
-- layouts/shortcodes/myshortcodetext.html --
-- layouts/_shortcodes/myshortcodetext.html --
{{ warnf "mytext %s" now}}
{{ $r := resources.Get "myshortcodetext.txt" }}
My Shortcode Text: {{ $r.Content }}|{{ $r.Permalink }}|
-- layouts/_default/_markup/render-codeblock-myothertext.html --
-- layouts/_markup/render-codeblock-myothertext.html --
{{ $r := resources.Get "myothertext.txt" }}
My Other Text: {{ $r.Content }}|{{ $r.Permalink }}|
@@ -181,7 +181,7 @@ disableKinds = ["taxonomy", "term", "sitemap", "robotsTXT", "404", "rss"]
-- content/mybundle/index.md --
-- content/mybundle/mydata.yml --
foo: bar
-- layouts/_default/single.html --
-- layouts/single.html --
MyData: {{ .Resources.Get "mydata.yml" | transform.Unmarshal }}|
`
b := TestRunning(t, files)
@@ -298,7 +298,7 @@ disableLiveReload = true
---
title: "P1"
---
-- layouts/index.html --
-- layouts/home.html --
Pages: {{ range .Site.RegularPages }}{{ .RelPermalink }}|{{ end }}$
`
b := TestRunning(t, files)
@@ -357,7 +357,7 @@ weight = 13
-- content/foo/p1.h.md --
-- content/foo/p1.i.md --
-- content/foo/p1.j.md --
-- layouts/index.html --
-- layouts/home.html --
RegularPages: {{ range .Site.RegularPages }}{{ .RelPermalink }}|{{ end }}$
`
b := TestRunning(t, files)
@@ -410,9 +410,9 @@ disableLiveReload = true
title: "P1"
weight: 1
---
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
-- layouts/index.html --
-- layouts/home.html --
Pages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$
`
@@ -433,9 +433,9 @@ disableLiveReload = true
title: "P1"
weight: 1
---
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
-- layouts/index.html --
-- layouts/home.html --
Pages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$
`
@@ -459,11 +459,11 @@ outputs: ["html", "json"]
P1 Content.
{{< myshort >}}
-- layouts/_default/single.html --
-- layouts/single.html --
Single HTML: {{ .Title }}|{{ .Content }}|
-- layouts/_default/single.json --
-- layouts/single.json --
Single JSON: {{ .Title }}|{{ .Content }}|
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
My short.
`
b := Test(t, files, TestOptRunning())
@@ -471,12 +471,12 @@ My short.
b.AssertRenderCountContent(1)
b.AssertFileContent("public/p1/index.html", "Single HTML: P1|<p>P1 Content.</p>\n")
b.AssertFileContent("public/p1/index.json", "Single JSON: P1|<p>P1 Content.</p>\n")
b.EditFileReplaceAll("layouts/_default/single.html", "Single HTML", "Single HTML Edited").Build()
b.EditFileReplaceAll("layouts/single.html", "Single HTML", "Single HTML Edited").Build()
b.AssertFileContent("public/p1/index.html", "Single HTML Edited: P1|<p>P1 Content.</p>\n")
b.AssertRenderCountPage(1)
// Edit shortcode. Note that this is reused across all output formats.
b.EditFileReplaceAll("layouts/shortcodes/myshort.html", "My short", "My short edited").Build()
b.EditFileReplaceAll("layouts/_shortcodes/myshort.html", "My short", "My short edited").Build()
b.AssertFileContent("public/p1/index.html", "My short edited")
b.AssertFileContent("public/p1/index.json", "My short edited")
b.AssertRenderCountPage(3) // rss (uses .Content) + 2 single pages.
@@ -489,17 +489,17 @@ title = "Hugo Site"
baseURL = "https://example.com"
disableKinds = ["term", "taxonomy"]
disableLiveReload = true
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Baseof: {{ .Title }}|
{{ block "main" . }}default{{ end }}
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
Home: {{ .Title }}|{{ .Content }}|
{{ end }}
`
testRebuildBothWatchingAndRunning(t, files, func(b *IntegrationTestBuilder) {
b.AssertFileContent("public/index.html", "Baseof: Hugo Site|", "Home: Hugo Site||")
b.EditFileReplaceFunc("layouts/_default/baseof.html", func(s string) string {
b.EditFileReplaceFunc("layouts/baseof.html", func(s string) string {
return strings.Replace(s, "Baseof", "Baseof Edited", 1)
}).Build()
b.AssertFileContent("public/index.html", "Baseof Edited: Hugo Site|", "Home: Hugo Site||")
@@ -520,7 +520,7 @@ disableLiveReload = true
title: "P1"
---
P1 Content.
-- layouts/index.html --
-- layouts/home.html --
Home.
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
@@ -557,22 +557,22 @@ title: "P1"
---
P1 Content.
[foo](/foo)
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Baseof: {{ .Title }}|
{{ block "main" . }}default{{ end }}
{{ with (templates.Defer (dict "foo" "bar")) }}
Defer.
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
Home.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
Single: {{ .Title }}|{{ .Content }}|
{{ end }}
`
b := Test(t, files, TestOptRunning())
b.AssertFileContent("public/p1/index.html", "Single: P1|")
b.EditFileReplaceFunc("layouts/_default/single.html", func(s string) string {
b.EditFileReplaceFunc("layouts/single.html", func(s string) string {
return strings.Replace(s, "Single", "Single Edited", 1)
}).Build()
b.AssertFileContent("public/p1/index.html", "Single Edited")
@@ -593,15 +593,15 @@ title: "P1"
---
P1 Content.
[foo](/foo)
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Baseof: {{ .Title }}|
{{ block "main" . }}default{{ end }}
{{ with (templates.Defer (dict "foo" "bar")) }}
Defer.
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
Home.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
Single: {{ .Title }}|{{ .Content }}|
{{ end }}
@@ -609,7 +609,7 @@ Single: {{ .Title }}|{{ .Content }}|
b := Test(t, files, TestOptRunning())
b.AssertFileContent("public/p1/index.html", "Single: P1|")
fmt.Println("===============")
b.EditFileReplaceAll("layouts/_default/baseof.html", "Baseof", "Baseof Edited").Build()
b.EditFileReplaceAll("layouts/baseof.html", "Baseof", "Baseof Edited").Build()
b.AssertFileContent("public/p1/index.html", "Baseof Edited")
}
@@ -628,7 +628,7 @@ title: "P1"
---
P1 Content.
[foo](/foo)
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Baseof: {{ .Title }}|
{{ block "main" . }}default{{ end }}
{{ with (templates.Defer (dict "foo" "bar")) }}
@@ -638,12 +638,12 @@ Defer.
{{ define "main" }}
Single: {{ .Title }}|{{ .Content }}|
{{ end }}
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
Render Link.
`
b := Test(t, files, TestOptRunning())
// Edit render hook.
b.EditFileReplaceAll("layouts/_default/_markup/render-link.html", "Render Link", "Render Link Edited").Build()
b.EditFileReplaceAll("layouts/_markup/render-link.html", "Render Link", "Render Link Edited").Build()
b.AssertFileContent("public/p1/index.html", "Render Link Edited")
}
@@ -668,12 +668,12 @@ layout: "l2"
P2 Content.
-- assets/mytext.txt --
My Text
-- layouts/_default/l1.html --
-- layouts/l1.html --
{{ $r := partial "get-resource.html" . }}
L1: {{ .Title }}|{{ .Content }}|R: {{ $r.Content }}|
-- layouts/_default/l2.html --
-- layouts/l2.html --
L2.
-- layouts/partials/get-resource.html --
-- layouts/_partials/get-resource.html --
{{ $mytext := resources.Get "mytext.txt" }}
{{ $txt := printf "Text: %s" $mytext.Content }}
{{ $r := resources.FromString "r.txt" $txt }}
@@ -727,11 +727,11 @@ title: "P6"
---
title: "P7"
---
-- layouts/_default/list.html --
-- layouts/list.html --
List.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
-- layouts/_default/single.html --
-- layouts/single.html --
Next: {{ with .PrevInSection }}{{ .Title }}{{ end }}|
Prev: {{ with .NextInSection }}{{ .Title }}{{ end }}|
@@ -919,19 +919,19 @@ P7 EN Content.
title: "P7 NN"
---
P7 NN Content.
-- layouts/index.html --
-- layouts/home.html --
Home: {{ .Title }}|{{ .Content }}|
RegularPages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$
Len RegularPagesRecursive: {{ len .RegularPagesRecursive }}
Site.Lastmod: {{ .Site.Lastmod.Format "2006-01-02" }}|
Paginate: {{ range (.Paginate .Site.RegularPages).Pages }}{{ .RelPermalink }}|{{ .Title }}|{{ end }}$
-- layouts/_default/single.html --
-- layouts/single.html --
Single: .Site: {{ .Site }}
Single: {{ .Title }}|{{ .Content }}|
Single Partial Cached: {{ partialCached "pcached" . }}|
Page.Lastmod: {{ .Lastmod.Format "2006-01-02" }}|
Cascade param: {{ .Params.cascadeparam }}|
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .Content }}|
RegularPages: {{ range .RegularPages }}{{ .Title }}|{{ end }}$
Len RegularPagesRecursive: {{ len .RegularPagesRecursive }}
@@ -939,11 +939,11 @@ RegularPagesRecursive: {{ range .RegularPagesRecursive }}{{ .RelPermalink }}|{{
List Partial P1: {{ partial "p1" . }}|
Page.Lastmod: {{ .Lastmod.Format "2006-01-02" }}|
Cascade param: {{ .Params.cascadeparam }}|
-- layouts/partials/p1.html --
-- layouts/_partials/p1.html --
Partial P1.
-- layouts/partials/pcached.html --
-- layouts/_partials/pcached.html --
Partial Pcached.
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0)}}
.Page.Site: {{ .Page.Site }} :: site: {{ site }}
{{ with $p }}
@@ -951,7 +951,7 @@ Shortcode Include: {{ .Title }}|
{{ end }}
Shortcode .Page.Title: {{ .Page.Title }}|
Shortcode Partial P1: {{ partial "p1" . }}|
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
{{ $p := site.GetPage (.Attributes.page)}}
{{ with $p }}
Codeblock Include: {{ .Title }}|
@@ -1046,26 +1046,26 @@ Codeblock Include: {{ .Title }}|
b.AssertFileContent("public/en/translations/index.html", "RegularPagesRecursive: /en/translations/p7/")
// Edit shortcode
editFile("layouts/shortcodes/include.html", func(s string) string {
editFile("layouts/_shortcodes/include.html", func(s string) string {
return s + "\nShortcode Include Edited."
})
b.AssertFileContent("public/mysect/p1/index.html", "Shortcode Include Edited.")
// Edit render hook
editFile("layouts/_default/_markup/render-codeblock.html", func(s string) string {
editFile("layouts/_markup/render-codeblock.html", func(s string) string {
return s + "\nCodeblock Include Edited."
})
b.AssertFileContent("public/mysect/p1/index.html", "Codeblock Include Edited.")
// Edit partial p1
editFile("layouts/partials/p1.html", func(s string) string {
editFile("layouts/_partials/p1.html", func(s string) string {
return strings.Replace(s, "Partial P1", "Partial P1 Edited", 1)
})
b.AssertFileContent("public/mysect/index.html", "List Partial P1: Partial P1 Edited.")
b.AssertFileContent("public/mysect/p1/index.html", "Shortcode Partial P1: Partial P1 Edited.")
// Edit partial cached.
editFile("layouts/partials/pcached.html", func(s string) string {
editFile("layouts/_partials/pcached.html", func(s string) string {
return strings.Replace(s, "Partial Pcached", "Partial Pcached Edited", 1)
})
b.AssertFileContent("public/mysect/p1/index.html", "Pcached Edited.")
@@ -1142,7 +1142,7 @@ body {
}
-- layouts/default/list.html --
List.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
{{ $css := resources.Get "main.css" | minify }}
RelPermalink: {{ $css.RelPermalink }}|
@@ -1192,13 +1192,13 @@ title: "P4"
P4.
-- assets/js/main.js --
console.log("Hello");
-- layouts/_default/list.html --
-- layouts/list.html --
List. {{ partial "head.html" . }}$
-- layouts/_default/single.html --
-- layouts/single.html --
Single. {{ partial "head.html" . }}$
-- layouts/partials/head.html --
-- layouts/_partials/head.html --
{{ partialCached "js.html" . }}$
-- layouts/partials/js.html --
-- layouts/_partials/js.html --
{{ $js := resources.Get "js/main.js" | js.Build | fingerprint }}
RelPermalink: {{ $js.RelPermalink }}|
`
@@ -1227,14 +1227,14 @@ disableKinds = ["term", "taxonomy", "sitemap", "robotsTXT", "404", "rss"]
disableLiveReload = true
-- assets/js/main.js --
console.log("Hello");
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Base. {{ partial "common/head.html" . }}$
{{ block "main" . }}default{{ end }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ define "main" }}main{{ end }}
-- layouts/partials/common/head.html --
-- layouts/_partials/common/head.html --
{{ partial "myfiles/js.html" . }}$
-- layouts/partials/myfiles/js.html --
-- layouts/_partials/myfiles/js.html --
{{ $js := resources.Get "js/main.js" | js.Build | fingerprint }}
RelPermalink: {{ $js.RelPermalink }}|
`
@@ -1280,24 +1280,24 @@ layout: "plain"
console.log("Hello");
-- content/foo.js --
console.log("Foo");
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $js := site.Home.Resources.Get "main.js" }}
{{ with $js }}
<script src="{{ .RelPermalink }}"></script>
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
Single. Deliberately no .Content in here.
-- layouts/_default/plain.html --
-- layouts/plain.html --
Content: {{ .Content }}|
-- layouts/_default/main.html --
-- layouts/main.html --
{{ $js := site.Home.Resources.Get "main.js" }}
{{ with $js }}
<script>
{{ .Content }}
</script>
{{ end }}
-- layouts/shortcodes/jsfingerprinted.html --
-- layouts/_shortcodes/jsfingerprinted.html --
{{ $js := site.Home.Resources.Get "foo.js" | fingerprint }}
<script src="{{ $js.RelPermalink }}"></script>
`
@@ -1368,13 +1368,13 @@ title: "P1"
---
Foo inline: {{< foo.inline >}}{{ site.Data.mydata.foo }}|{{< /foo.inline >}}
-- layouts/shortcodes/data.html --
-- layouts/_shortcodes/data.html --
{{ $path := split (.Get 0) "." }}
{{ $data := index site.Data $path }}
Foo: {{ $data }}|
-- layouts/index.html --
-- layouts/home.html --
Content: {{ .Content }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Content }}|
`
b := TestRunning(t, files)
@@ -1400,7 +1400,7 @@ disableLiveReload = true
title: "Home"
---
Home.
-- layouts/index.html --
-- layouts/home.html --
Content: {{ .Content }}
`
b := TestRunning(t, files)
@@ -1436,9 +1436,9 @@ disableKinds = ["taxonomy", "term", "sitemap", "robotsTXT", "404"]
title: "Home"
---
Home.
-- layouts/index.html --
-- layouts/home.html --
Home.
-- layouts/_default/index.searchindex.txt --
-- layouts/index.searchindex.txt --
Text. {{ .Title }}|{{ .RelPermalink }}|
`
@@ -1446,7 +1446,7 @@ Text. {{ .Title }}|{{ .RelPermalink }}|
b.AssertFileContent("public/search.txt", "Text.")
b.EditFileReplaceAll("layouts/_default/index.searchindex.txt", "Text.", "Text Edited.").Build()
b.EditFileReplaceAll("layouts/index.searchindex.txt", "Text.", "Text Edited.").Build()
b.BuildPartial("/docs/search.txt")
@@ -1460,7 +1460,7 @@ func TestRebuildVariationsAssetsJSImport(t *testing.T) {
baseURL = "https://example.com"
disableKinds = ["term", "taxonomy"]
disableLiveReload = true
-- layouts/index.html --
-- layouts/home.html --
Home. {{ now }}
{{ with (resources.Get "js/main.js" | js.Build | fingerprint) }}
<script>{{ .Content | safeJS }}</script>
@@ -1529,28 +1529,28 @@ title: "P3"
layout: "foo"
---
{{< notfingerprinted >}}
-- layouts/shortcodes/fingerprinted.html --
-- layouts/_shortcodes/fingerprinted.html --
Fingerprinted.
{{ $opts := dict "inlineImports" true "noMap" true }}
{{ with (resources.Get "css/main.css" | postCSS $opts | fingerprint) }}
<style src="{{ .RelPermalink }}"></style>
{{ end }}
-- layouts/shortcodes/notfingerprinted.html --
-- layouts/_shortcodes/notfingerprinted.html --
Fingerprinted.
{{ $opts := dict "inlineImports" true "noMap" true }}
{{ with (resources.Get "css/main.css" | postCSS $opts) }}
<style src="{{ .RelPermalink }}"></style>
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $opts := dict "inlineImports" true "noMap" true }}
{{ with (resources.Get "css/main.css" | postCSS $opts) }}
<style>{{ .Content | safeCSS }}</style>
{{ end }}
-- layouts/_default/foo.html --
-- layouts/foo.html --
Foo.
{{ .Title }}|{{ .Content }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
{{ $opts := dict "inlineImports" true "noMap" true }}
{{ with (resources.Get "css/main.css" | postCSS $opts) }}
@@ -1592,7 +1592,7 @@ baseURL = "https://example.com"
disableLiveReload = true
-- i18n/en.toml --
hello = "Hello"
-- layouts/index.html --
-- layouts/home.html --
Hello: {{ i18n "hello" }}
`
@@ -1643,7 +1643,7 @@ title: "B nn"
B nn.
-- content/p1/f1.nn.txt --
F1 nn
-- layouts/_default/all.html --
-- layouts/all.html --
All: {{ .Title }}|{{ .Kind }}|{{ .Content }}|Bundled File: {{ with .Resources.GetMatch "f1.*" }}{{ .Content }}{{ end }}|Bundled Page: {{ with .Resources.GetMatch "b.*" }}{{ .Content }}{{ end }}|
`
@@ -1683,7 +1683,7 @@ title: "P1 en"
title: "P1 nn"
---
P1 nn.
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
`
@@ -1710,7 +1710,7 @@ body {
}
-- assets/css/main.scss --
@import "lib/foo";
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $opts := dict "transpiler" "TRANSPILER" }}
{{ with (resources.Get "css/main.scss" | toCSS $opts) }}
@@ -1756,9 +1756,9 @@ func benchmarkFilesEdit(count int) string {
baseURL = "https://example.com"
disableKinds = ["term", "taxonomy"]
disableLiveReload = true
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .Content }}|
-- content/mysect/_index.md --
---
@@ -1815,7 +1815,7 @@ c
c1
-- assets/common/c2.css --
c2
-- layouts/index.html --
-- layouts/home.html --
{{ $a := resources.Get "a.css" }}
{{ $b := resources.Get "b.css" }}
{{ $common := resources.Match "common/*.css" | resources.Concat "common.css" | minify }}
@@ -1856,9 +1856,9 @@ func TestRebuildEditMixedCaseTemplateFileIssue12165(t *testing.T) {
-- hugo.toml --
baseURL = "https://example.com"
disableLiveReload = true
-- layouts/partials/MyTemplate.html --
-- layouts/_partials/MyTemplate.html --
MyTemplate
-- layouts/index.html --
-- layouts/home.html --
MyTemplate: {{ partial "MyTemplate.html" . }}|
@@ -1868,7 +1868,7 @@ MyTemplate: {{ partial "MyTemplate.html" . }}|
b.AssertFileContent("public/index.html", "MyTemplate: MyTemplate")
b.EditFileReplaceAll("layouts/partials/MyTemplate.html", "MyTemplate", "MyTemplate Edited").Build()
b.EditFileReplaceAll("layouts/_partials/MyTemplate.html", "MyTemplate", "MyTemplate Edited").Build()
b.AssertFileContent("public/index.html", "MyTemplate: MyTemplate Edited")
}
@@ -1949,7 +1949,7 @@ P1 Content.
title: "P2"
---
P2 Content.
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .Content }}|
`
b := TestRunning(t, files)
@@ -1972,9 +1972,9 @@ func TestRebuildEditSingleListChangeUbuntuIssue12362(t *testing.T) {
-- hugo.toml --
disableKinds = ['rss','section','sitemap','taxonomy','term']
disableLiveReload = true
-- layouts/_default/list.html --
-- layouts/list.html --
{{ range .Pages }}{{ .Title }}|{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
-- content/p1.md --
---
@@ -1997,9 +1997,9 @@ func TestRebuildHomeThenPageIssue12436(t *testing.T) {
baseURL = "https://example.com"
disableKinds = ['sitemap','taxonomy','term']
disableLiveReload = true
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Content }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/_index.md --
---

View File

@@ -50,16 +50,16 @@ title: "p3"
### p3-h2
{{% withmarkdown %}}
{{< level3 >}}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/withhtml.html --
-- layouts/_shortcodes/withhtml.html --
<div>{{ .Page.Title }} withhtml</div>
-- layouts/shortcodes/withmarkdown.html --
-- layouts/_shortcodes/withmarkdown.html --
#### {{ .Page.Title }} withmarkdown
-- layouts/shortcodes/level3.html --
-- layouts/_shortcodes/level3.html --
Level 3: {{ .Page.Title }}
-- layouts/_default/single.html --
-- layouts/single.html --
Fragments: {{ .Fragments.Identifiers }}|
HasShortcode Level 1: {{ .HasShortcode "include" }}|
HasShortcode Level 2: {{ .HasShortcode "withmarkdown" }}|
@@ -100,16 +100,16 @@ title: "p2"
---
### p2-h1
{{% myshort %}}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
Myshort HTML.
-- layouts/shortcodes/myshort.json --
-- layouts/_shortcodes/myshort.json --
Myshort JSON.
-- layouts/_default/single.html --
-- layouts/single.html --
HTML: {{ .Content }}
-- layouts/_default/single.json --
-- layouts/single.json --
JSON: {{ .Content }}
@@ -141,19 +141,19 @@ title: "p2"
---
### p2-h1
{{% myshort %}}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
Myshort Original.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
b := TestRunning(t, files)
b.AssertNoRenderShortcodesArtifacts()
b.AssertFileContent("public/p1/index.html", "Myshort Original.")
b.EditFileReplaceAll("layouts/shortcodes/myshort.html", "Original", "Edited").Build()
b.EditFileReplaceAll("layouts/_shortcodes/myshort.html", "Original", "Edited").Build()
b.AssertNoRenderShortcodesArtifacts()
b.AssertFileContent("public/p1/index.html", "Myshort Edited.")
}
@@ -177,12 +177,12 @@ title: "p2"
---
### Original
{{% myshort %}}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
Myshort Original.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
@@ -227,12 +227,12 @@ title: "p2"
---
### Original
{{% myshort %}}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := .Page.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
Myshort Original.
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Content }}
@@ -253,20 +253,20 @@ func TestRenderShortcodesNestedPageContextIssue12356(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss", "sitemap", "robotsTXT", "404"]
-- layouts/_default/_markup/render-image.html --
-- layouts/_markup/render-image.html --
{{- with .PageInner.Resources.Get .Destination -}}Image: {{ .RelPermalink }}|{{- end -}}
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
{{- with .PageInner.GetPage .Destination -}}Link: {{ .RelPermalink }}|{{- end -}}
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
Heading: {{ .PageInner.Title }}: {{ .PlainText }}|
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
CodeBlock: {{ .PageInner.Title }}: {{ .Type }}|
-- layouts/_default/list.html --
-- layouts/list.html --
Content:{{ .Content }}|
Fragments: {{ with .Fragments }}{{.Identifiers }}{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Content:{{ .Content }}|
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ with site.GetPage (.Get 0) }}
{{ .RenderShortcodes }}
{{ end }}
@@ -364,11 +364,11 @@ title: "p1"
title: "p2"
---
Hello <b>world</b>. Some **bold** text. Some Unicode: 神真美好.
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ with site.GetPage (.Get 0) }}
<div>{{ .RenderShortcodes }}</div>
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -421,13 +421,13 @@ title: "p3"
§§§ php
code_p3
§§§
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ with site.GetPage (.Get 0) -}}
{{ .RenderShortcodes -}}
{{ end -}}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
<code>{{ .Inner | safeHTML }}</code>
`
@@ -467,10 +467,10 @@ title: "p2"
### p2-h1
This is some **markup**.
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) -}}
{{ $p.RenderShortcodes -}}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
b := TestRunning(t, files)
@@ -488,11 +488,11 @@ func TestRenderShortcodesEmptyParagraph(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['section','rss','sitemap','taxonomy','term']
-- layouts/_default/home.html --
-- layouts/home.html --
{{ .Content }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ with site.GetPage (.Get 0) }}
{{ .RenderShortcodes }}
{{ end }}

View File

@@ -25,7 +25,7 @@ func TestRenderString(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ $p := site.GetPage "p1.md" }}
{{ $optBlock := dict "display" "block" }}
{{ $optOrg := dict "markup" "org" }}
@@ -33,7 +33,7 @@ RSTART:{{ "**Bold Markdown**" | $p.RenderString }}:REND
RSTART:{{ "**Bold Block Markdown**" | $p.RenderString $optBlock }}:REND
RSTART:{{ "/italic org mode/" | $p.RenderString $optOrg }}:REND
RSTART:{{ "## Header2" | $p.RenderString }}:REND
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
Hook Heading: {{ .Level }}
-- content/p1.md --
---
@@ -57,11 +57,11 @@ func TestRenderStringOnListPage(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ .RenderString "**Hello**" }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .RenderString "**Hello**" }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .RenderString "**Hello**" }}
-- content/mysection/p1.md --
FOO
@@ -86,7 +86,7 @@ func TestRenderStringOnPageNotBackedByAFile(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ["page", "section", "taxonomy", "term"]
-- layouts/index.html --
-- layouts/home.html --
{{ .RenderString "**Hello**" }}
-- content/p1.md --
`
@@ -106,18 +106,18 @@ enableInlineShortcodes = true
title: "P1"
---
## First
-- layouts/shortcodes/mark1.md --
-- layouts/_shortcodes/mark1.md --
{{ .Inner }}
-- layouts/shortcodes/mark2.md --
-- layouts/_shortcodes/mark2.md --
1. Item Mark2 1
1. Item Mark2 2
1. Item Mark2 2-1
1. Item Mark2 3
-- layouts/shortcodes/myhthml.html --
-- layouts/_shortcodes/myhthml.html --
Title: {{ .Page.Title }}
TableOfContents: {{ .Page.TableOfContents }}
Page Type: {{ printf "%T" .Page }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .RenderString "Markdown: {{% mark2 %}}|HTML: {{< myhthml >}}|Inline: {{< foo.inline >}}{{ site.Title }}{{< /foo.inline >}}|" }}
HasShortcode: mark2:{{ .HasShortcode "mark2" }}:true
HasShortcode: foo:{{ .HasShortcode "foo" }}:false
@@ -153,7 +153,7 @@ Page Type: *hugolib.pageForShortcode`,
},
).Build()
b.EditFiles("layouts/shortcodes/myhthml.html", "Edit shortcode").Build()
b.EditFiles("layouts/_shortcodes/myhthml.html", "Edit shortcode").Build()
b.AssertFileContent("public/p1/index.html",
`Edit shortcode`,
@@ -167,9 +167,9 @@ func TestRenderStringWithShortcodeInPageWithNoContentFile(t *testing.T) {
files := `
-- config.toml --
-- layouts/shortcodes/myshort.html --
-- layouts/_shortcodes/myshort.html --
Page Kind: {{ .Page.Kind }}
-- layouts/index.html --
-- layouts/home.html --
Short: {{ .RenderString "{{< myshort >}}" }}
Has myshort: {{ .HasShortcode "myshort" }}
Has other: {{ .HasShortcode "other" }}
@@ -204,11 +204,11 @@ title: "P1"
{{ not a shortcode
{{< /noop >}}
}
-- layouts/shortcodes/noop.html --
-- layouts/_shortcodes/noop.html --
{{ .Inner | $.Page.RenderString }}
-- layouts/shortcodes/toc.html --
-- layouts/_shortcodes/toc.html --
{{ .Page.TableOfContents }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`

View File

@@ -47,7 +47,7 @@ func TestResourceChainBasic(t *testing.T) {
baseURL = "http://example.com/"
-- assets/images/sunset.jpg --
` + getTestSunset(t) + `
-- layouts/index.html --
-- layouts/home.html --
{{ $hello := "<h1> Hello World! </h1>" | resources.FromString "hello.html" | fingerprint "sha512" | minify | fingerprint }}
{{ $cssFingerprinted1 := "body { background-color: lightblue; }" | resources.FromString "styles.css" | minify | fingerprint }}
{{ $cssFingerprinted2 := "body { background-color: orange; }" | resources.FromString "styles2.css" | minify | fingerprint }}
@@ -132,10 +132,10 @@ title: Page1
---
title: Page2
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ $hello := "<h1> Hello World! </h1>" | resources.FromString "hello.html" | minify | fingerprint "md5" | resources.PostProcess }}
HELLO: {{ $hello.RelPermalink }}
-- layouts/index.html --
-- layouts/home.html --
Start.
{{ $hello := "<h1> Hello World! </h1>" | resources.FromString "hello.html" | minify | fingerprint "md5" | resources.PostProcess }}
@@ -705,7 +705,7 @@ T3: Content: {{ $combinedJs.Content }}|{{ $combinedJs.RelPermalink }}
.content-navigation
border-color: $color
-- layouts/index.html --
-- layouts/home.html --
{{ $a := "A" | resources.FromString "a.txt"}}
{{ $b := "B" | resources.FromString "b.txt"}}
{{ $c := "C" | resources.FromString "c.txt"}}
@@ -1358,7 +1358,7 @@ json2 content
-- assets/jsons/data3.xml --
xml content
-- content/page.md --
-- layouts/index.html --
-- layouts/home.html --
{{ $jsons := (resources.Match "jsons/*.json") }}
{{ $json := (resources.GetMatch "jsons/*.json") }}
{{ printf "jsonsMatch: %d" (len $jsons) }}
@@ -1390,7 +1390,7 @@ disableXML=true
-- assets/xml/data.xml --
<root> <foo> asdfasdf </foo> </root>
-- content/page.md --
-- layouts/index.html --
-- layouts/home.html --
{{ $xml := resources.Get "xml/data.xml" | minify | fingerprint }}
XML: {{ $xml.Content | safeHTML }}|{{ $xml.RelPermalink }}
`

View File

@@ -72,17 +72,17 @@ disableKinds = ['section','sitemap','taxonomy','term']
enableDefault = true
[markup.goldmark.renderHooks.link]
enableDefault = true
-- layouts/_default/_markup/render-image.html --
-- layouts/_markup/render-image.html --
{{- $u := urls.Parse .Destination -}}
{{- $src := $u.String | relURL -}}
<img srcset="{{ $src }}" src="{{ $src }} 2x">
<img src="{{ $src }}">
{{- /**/ -}}
-- layouts/_default/home.html --
-- layouts/home.html --
{{ .Content }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}|
-- layouts/_default/rss.xml --
-- layouts/rss.xml --
{{ with site.GetPage "/s1/p2" }}
{{ .Content | transform.XMLEscape | safeHTML }}
{{ end }}

View File

@@ -35,7 +35,7 @@ func TestSecurityPolicies(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ os.Getenv "FOOBAR" }}
`
_, err := TestE(c, files)
@@ -48,7 +48,7 @@ baseURL = "https://example.org"
files := `
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ os.Getenv "HUGO_FOO" }}
`
Test(c, files)
@@ -117,7 +117,7 @@ foo
files := `
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ $scss := "body { color: #333; }" | resources.FromString "foo.scss" | css.Sass (dict "transpiler" "dartsass") }}
`
Test(c, files)
@@ -134,7 +134,7 @@ baseURL = "https://example.org"
[security]
[security.exec]
allow="none"
-- layouts/index.html --
-- layouts/home.html --
{{ $scss := "body { color: #333; }" | resources.FromString "foo.scss" | css.Sass (dict "transpiler" "dartsass") }}
`
_, err := TestE(c, files)
@@ -151,7 +151,7 @@ allow="none"
files := fmt.Sprintf(`
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ $json := resources.GetRemote "%s/fruits.json" }}{{ $json.Content }}
`, ts.URL)
Test(c, files)
@@ -166,7 +166,7 @@ baseURL = "https://example.org"
files := fmt.Sprintf(`
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ $json := resources.GetRemote "%s/fruits.json" (dict "method" "DELETE" ) }}{{ $json.Content }}
`, ts.URL)
_, err := TestE(c, files)
@@ -186,7 +186,7 @@ baseURL = "https://example.org"
[security]
[security.http]
urls="none"
-- layouts/index.html --
-- layouts/home.html --
{{ $json := resources.GetRemote "%s/fruits.json" }}{{ $json.Content }}
`, ts.URL)
_, err := TestE(c, files)
@@ -204,7 +204,7 @@ urls="none"
-- hugo.toml --
baseURL = "https://example.org"
[security]
-- layouts/index.html --
-- layouts/home.html --
{{ $json := resources.GetRemote "%s/fakejson.json" }}{{ $json.Content }}
`, ts.URL)
_, err := TestE(c, files)
@@ -224,7 +224,7 @@ baseURL = "https://example.org"
[security]
[security.http]
mediaTypes=["application/json"]
-- layouts/index.html --
-- layouts/home.html --
{{ $json := resources.GetRemote "%s/fakejson.json" }}{{ $json.Content }}
`, ts.URL)
Test(c, files)

View File

@@ -45,9 +45,9 @@ lang = "n*"
output = "rss"
[[segments.docs.excludes]]
output = "json"
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}|{{ .RelPermalink }}|
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}|{{ .RelPermalink }}|
-- content/docs/_index.md --
-- content/docs/section1/_index.md --

View File

@@ -26,7 +26,7 @@ func TestEncodePage(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
Page: |{{ index .Site.RegularPages 0 | jsonify }}|
Site: {{ site | jsonify }}
-- content/page.md --

View File

@@ -92,9 +92,9 @@ C
---
title: "My Bundle"
---
-- layouts/_default/list.html --
-- layouts/list.html --
Kind: {{ .Kind }}|RelPermalink: {{ .RelPermalink }}|SectionsPath: {{ .SectionsPath }}|SectionsEntries: {{ .SectionsEntries }}|Len: {{ len .SectionsEntries }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Kind: {{ .Kind }}|RelPermalink: {{ .RelPermalink }}|SectionsPath: {{ .SectionsPath }}|SectionsEntries: {{ .SectionsEntries }}|Len: {{ len .SectionsEntries }}|
`
@@ -114,9 +114,9 @@ baseURL = "https://example.com/"
-- content/docs/logs/_index.md --
-- content/docs/logs/sdk.md --
-- content/docs/logs/sdk_exporters/stdout.md --
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .RelPermalink }}|{{ with .Parent}}{{ .RelPermalink }}{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .RelPermalink }}|{{ with .Parent}}{{ .RelPermalink }}{{ end }}|
`

View File

@@ -120,7 +120,7 @@ date: 2023-03-01
---
date: 2023-04-01
---
-- layouts/index.html --
-- layouts/home.html --
site.Lastmod: {{ .Site.Lastmod.Format "2006-01-02" }}
home.Lastmod: {{ site.Home.Lastmod.Format "2006-01-02" }}

View File

@@ -243,9 +243,9 @@ func TestShouldAlwaysHaveUglyURLs(t *testing.T) {
t.Parallel()
basefiles := `
-- layouts/index.html --
-- layouts/home.html --
Home Sweet {{ if.IsHome }}Home{{ end }}.
-- layouts/_default/single.html --
-- layouts/single.html --
{{.Content}}{{ if.IsHome }}This is not home!{{ end }}
-- layouts/404.html --
Page Not Found.{{ if.IsHome }}This is not home!{{ end }}
@@ -331,7 +331,7 @@ disableKinds = ['RSS','sitemap','taxonomy','term']
[params]
mainSections=["a", "b"]
-- content/mysect/page1.md --
-- layouts/index.html --
-- layouts/home.html --
{{/* Behaviour before Hugo 0.112.0. */}}
MainSections Params: {{ site.Params.mainSections }}|
MainSections Site method: {{ site.MainSections }}|
@@ -358,7 +358,7 @@ mainSections=["a", "b"]
[params.sub]
mainSections=["c", "d"]
-- content/mysect/page1.md --
-- layouts/index.html --
-- layouts/home.html --
{{/* Behaviour before Hugo 0.112.0. */}}
MainSections Params: {{ site.Params.mainSections }}|
MainSections Param sub: {{ site.Params.sub.mainSections }}|
@@ -383,7 +383,7 @@ MainSections Site method: [a b]|
-- config.toml --
disableKinds = ['RSS','sitemap','taxonomy','term']
-- content/mysect/page1.md --
-- layouts/index.html --
-- layouts/home.html --
MainSections Params: {{ site.Params.mainSections }}|
MainSections Site method: {{ site.MainSections }}|
@@ -446,9 +446,9 @@ title: ca
---
title: ca
---
-- layouts/index.html --
-- layouts/home.html --
Home
-- layouts/_default/single.html --
-- layouts/single.html --
Content: {{ .Content }}
`
@@ -470,7 +470,7 @@ minify = %t
[build]
writeStats = true
-- layouts/index.html --
-- layouts/home.html --
<div id="el1" class="a b c">Foo</div>
@@ -527,7 +527,7 @@ func TestClassCollectorConfigWriteStats(t *testing.T) {
files := `
-- hugo.toml --
` + writeStatsConfig + `
-- layouts/_default/list.html --
-- layouts/list.html --
<div id="myid" class="myclass">Foo</div>
`

View File

@@ -22,7 +22,7 @@ func TestSectionsEntries(t *testing.T) {
-- hugo.toml --
-- content/withfile/_index.md --
-- content/withoutfile/p1.md --
-- layouts/_default/list.html --
-- layouts/list.html --
SectionsEntries: {{ .SectionsEntries }}

View File

@@ -157,7 +157,7 @@ func TestSitemapAndContentBundleNamedSitemap(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['home','rss','section','taxonomy','term']
-- layouts/_default/single.html --
-- layouts/single.html --
layouts/_default/single.html
-- layouts/sitemap/single.html --
layouts/sitemap/single.html

View File

@@ -92,10 +92,10 @@ title: "This is T5"
---
title: "This is S3s"
---
-- layouts/_default/list.html --
-- layouts/list.html --
Taxonomy List Page 1|{{ .Title }}|Hello|{{ .Permalink }}|
-- layouts/_default/terms.html --
Taxonomy Term Page 1|{{ .Title }}|Hello|{{ .Permalink }}|
-- layouts/taxonomy.html --
Taxonomy Page 1|{{ .Title }}|Hello|{{ .Permalink }}|
`
b := Test(t, files)
@@ -125,9 +125,9 @@ Taxonomy Term Page 1|{{ .Title }}|Hello|{{ .Permalink }}|
b.AssertFileContent("public/t1/t2/t3s/t4/t5/index.html", "Taxonomy List Page 1|This is T5|Hello|https://example.com/t1/t2/t3s/t4/t5/|")
b.AssertFileContent("public/t1/t2/t3s/t4/t5/t6/index.html", "Taxonomy List Page 1|t4/t5/t6|Hello|https://example.com/t1/t2/t3s/t4/t5/t6/|")
b.AssertFileContent("public/news/categories/index.html", "Taxonomy Term Page 1|categories|Hello|https://example.com/news/categories/|")
b.AssertFileContent("public/t1/t2/t3s/index.html", "Taxonomy Term Page 1|t3s|Hello|https://example.com/t1/t2/t3s/|")
b.AssertFileContent("public/s1/s2/s3s/index.html", "Taxonomy Term Page 1|This is S3s|Hello|https://example.com/s1/s2/s3s/|")
b.AssertFileContent("public/news/categories/index.html", "Taxonomy Page 1|categories|Hello|https://example.com/news/categories/|")
b.AssertFileContent("public/t1/t2/t3s/index.html", "Taxonomy Page 1|t3s|Hello|https://example.com/t1/t2/t3s/|")
b.AssertFileContent("public/s1/s2/s3s/index.html", "Taxonomy Page 1|This is S3s|Hello|https://example.com/s1/s2/s3s/|")
}
// https://github.com/gohugoio/hugo/issues/5719
@@ -147,14 +147,14 @@ Content.
files := `
-- hugo.toml --
baseURL = "http://example.com"
-- layouts/index.html --
-- layouts/home.html --
<h1>Tags</h1>
<ul>
{{ range .Site.Taxonomies.tags }}
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
{{ end }}
</ul>
-- layouts/_default/terms.html --
-- layouts/taxonomy.html --
<h1>Terms</h1>
<ul>
{{ range .Data.Terms.Alphabetical }}
@@ -181,7 +181,7 @@ func TestTaxonomiesNotForDrafts(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/_default/list.html --
-- layouts/list.html --
List page.
-- content/draft.md --
---
@@ -228,7 +228,7 @@ categories: ["cool"]
---
Content.
-- layouts/index.html --
-- layouts/home.html --
{{ range .Site.Pages }}
{{ .RelPermalink }}|{{ .Title }}|{{ .WordCount }}|{{ .Content }}|
{{ end }}
@@ -267,7 +267,7 @@ categories: ["cool"]
---
Content.
-- layouts/index.html --
-- layouts/home.html --
NO HOME FOR YOU
`
@@ -285,7 +285,7 @@ func TestTaxonomiesWithBundledResources(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com"
-- layouts/_default/list.html --
-- layouts/list.html --
List {{ .Title }}:
{{ range .Resources }}
Resource: {{ .RelPermalink }}|{{ .MediaType }}
@@ -319,7 +319,7 @@ func TestTaxonomiesRemoveOne(t *testing.T) {
files := `
-- hugo.toml --
disableLiveReload = true
-- layouts/index.html --
-- layouts/home.html --
{{ $cats := .Site.Taxonomies.categories.cats }}
{{ if $cats }}
Len cats: {{ len $cats }}
@@ -380,7 +380,7 @@ func TestTaxonomiesListPages(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com"
-- layouts/_default/list.html --
-- layouts/list.html --
{{ template "print-taxo" "categories.cats" }}
{{ template "print-taxo" "categories.funny" }}
@@ -432,7 +432,7 @@ func TestTaxonomiesPageCollections(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com"
-- layouts/index.html --
-- layouts/home.html --
{{ $home := site.Home }}
{{ $section := site.GetPage "section" }}
{{ $categories := site.GetPage "categories" }}
@@ -510,7 +510,7 @@ titleCaseStyle = "none"
abcdef = "abcdefs"
abcdefg = "abcdefgs"
abcdefghi = "abcdefghis"
-- layouts/index.html --
-- layouts/home.html --
{{ range site.Pages }}Page: {{ template "print-page" . }}
{{ end }}
{{ $abc := site.GetPage "abcdefgs/abc" }}
@@ -563,7 +563,7 @@ title: "abcdefghijk"
func TestTaxonomiesWeightSort(t *testing.T) {
files := `
-- layouts/index.html --
-- layouts/home.html --
{{ $a := site.GetPage "tags/a"}}
:{{ range $a.Pages }}{{ .RelPermalink }}|{{ end }}:
-- content/p1.md --
@@ -606,7 +606,7 @@ tag = 'tags'
title = "P1"
tags = ''
+++
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
`
@@ -627,7 +627,7 @@ book authors:
- Neil Gaiman
- Terry Pratchett
---
-- layouts/index.html --
-- layouts/home.html --
{{- $taxonomy := "book authors" }}
Len Book Authors: {{ len (index .Site.Taxonomies $taxonomy) }}
`
@@ -686,7 +686,7 @@ tag = "tags"
title: "Home"
tags: ["hellO world"]
---
-- layouts/_default/term.html --
-- layouts/term.html --
{{ .Title }}|{{ .Kind }}|{{ .Data.Singular }}|{{ .Data.Plural }}|{{ .Page.Data.Term }}|
`
@@ -699,7 +699,7 @@ func TestTermDraft(t *testing.T) {
t.Parallel()
files := `
-- layouts/_default/list.html --
-- layouts/list.html --
|{{ .Title }}|
-- content/p1.md --
---
@@ -722,7 +722,7 @@ func TestTermBuildNeverRenderNorList(t *testing.T) {
t.Parallel()
files := `
-- layouts/index.html --
-- layouts/home.html --
|{{ len site.Taxonomies.tags }}|
-- content/p1.md --
---
@@ -779,10 +779,10 @@ func TestTaxonomyLookupIssue12193(t *testing.T) {
disableKinds = ['page','rss','section','sitemap']
[taxonomies]
author = 'authors'
-- layouts/_default/list.html --
{{ .Title }}|
-- layouts/_default/author.terms.html --
layouts/_default/author.terms.html
-- layouts/list.html --
list.html
-- layouts/authors/taxonomy.html --
authors/taxonomy.html
-- content/authors/_index.md --
---
title: Authors Page
@@ -793,7 +793,7 @@ title: Authors Page
b.AssertFileExists("public/index.html", true)
b.AssertFileExists("public/authors/index.html", true)
b.AssertFileContent("public/authors/index.html", "layouts/_default/author.terms.html") // failing test
b.AssertFileContent("public/authors/index.html", "authors/taxonomy.html")
}
func TestTaxonomyNestedEmptySectionsIssue12188(t *testing.T) {
@@ -810,9 +810,9 @@ weight = 1
weight = 2
[taxonomies]
's1/category' = 's1/category'
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}|
-- content/s1/p1.en.md --
---
@@ -840,9 +840,9 @@ baseURL = "https://example.com"
disableKinds = ["RSS", "sitemap", "section"]
[taxononomies]
tag = "tags"
-- layouts/_default/list.html --
-- layouts/list.html --
List.
-- layouts/_default/single.html --
-- layouts/single.html --
GetTerms.tags: {{ range .GetTerms "tags" }}{{ .Title }}|{{ end }}
-- content/_index.md --
`

View File

@@ -28,10 +28,10 @@ func TestTemplateBOM(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
` + bom + `
Base: {{ block "main" . }}base main{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
` + bom + `{{ define "main" }}Hi!?{{ end }}
-- content/page.md --
---
@@ -71,12 +71,12 @@ layout: "layout%d"
Content.
`, id, id))
b.WriteString(fmt.Sprintf("-- layouts/_default/layout%d.html --\n", id))
b.WriteString(fmt.Sprintf("-- layouts/layout%d.html --\n", id))
b.WriteString(fmt.Sprintf(`
{{ define "main" }}%d{{ end }}
`, id))
b.WriteString(fmt.Sprintf("-- layouts/_default/layout%d-baseof.html --\n", id))
b.WriteString(fmt.Sprintf("-- layouts/layout%d-baseof.html --\n", id))
b.WriteString(fmt.Sprintf(`
Base %d: {{ block "main" . }}FOO{{ end }}
`, id))
@@ -99,13 +99,13 @@ func TestTemplateNoBasePlease(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/_default/list.html --
-- layouts/list.html --
{{ define "main" }}
Bonjour
{{ end }}
{{ printf "list" }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ printf "single" }}
{{ define "main" }}
Bonjour
@@ -136,7 +136,7 @@ func TestTemplateBaseWithComment(t *testing.T) {
baseURL = "http://example.com/"
-- layouts/baseof.html --
Base: {{ block "main" . }}{{ end }}
-- layouts/index.html --
-- layouts/home.html --
{{/* A comment */}}
{{ define "main" }}
Bonjour
@@ -161,9 +161,9 @@ func TestTemplateLookupSite(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/_default/single.html --
-- layouts/single.html --
Single: {{ .Title }}
-- layouts/_default/list.html --
-- layouts/list.html --
List: {{ .Title }}
-- content/_index.md --
---
@@ -203,9 +203,9 @@ weight = 10
[languages.fr]
weight = 20
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}Main Home En{{ end }}
-- layouts/index.fr.html --
-- layouts/home.fr.html --
{{ define "main" }}Main Home Fr{{ end }}
-- layouts/baseof.html --
Baseof en: {{ block "main" . }}main block{{ end }}
@@ -213,9 +213,9 @@ Baseof en: {{ block "main" . }}main block{{ end }}
Baseof fr: {{ block "main" . }}main block{{ end }}
-- layouts/mysection/baseof.html --
Baseof mysection: {{ block "main" . }}mysection block{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}Main Default Single{{ end }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ define "main" }}Main Default List{{ end }}
-- content/mysection/p1.md --
---
@@ -252,11 +252,11 @@ weight = 10
[languages.fr]
weight = 20
-- layouts/index.html --
-- layouts/home.html --
Site: {{ site.Language.Lang }} / {{ .Site.Language.Lang }} / {{ site.BaseURL }}
Sites: {{ site.Sites.Default.Home.Language.Lang }}
Hugo: {{ hugo.Generator }}
-- layouts/index.fr.html --
-- layouts/home.fr.html --
Site: {{ site.Language.Lang }} / {{ .Site.Language.Lang }} / {{ site.BaseURL }}
Sites: {{ site.Sites.Default.Home.Language.Lang }}
Hugo: {{ hugo.Generator }}
@@ -286,21 +286,21 @@ func TestPartialWithReturn(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/partials/add42.tpl --
-- layouts/_partials/add42.tpl --
{{ $v := add . 42 }}
{{ return $v }}
-- layouts/partials/dollarContext.tpl --
-- layouts/_partials/dollarContext.tpl --
{{ $v := add $ 42 }}
{{ return $v }}
-- layouts/partials/dict.tpl --
-- layouts/_partials/dict.tpl --
{{ $v := add $.adder 42 }}
{{ return $v }}
-- layouts/partials/complex.tpl --
-- layouts/_partials/complex.tpl --
{{ return add . 42 }}
-- layouts/partials/hello.tpl --
-- layouts/_partials/hello.tpl --
{{ $v := printf "hello %s" . }}
{{ return $v }}
-- layouts/index.html --
-- layouts/home.html --
Test Partials With Return Values:
add42: 50: {{ partial "add42.tpl" 8 }}
@@ -333,7 +333,7 @@ func TestPartialWithZeroedArgs(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
X{{ partial "retval" dict }}X
X{{ partial "retval" slice }}X
X{{ partial "retval" "" }}X
@@ -368,13 +368,13 @@ func TestPartialCached(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ $key1 := (dict "a" "av" ) }}
{{ $key2 := (dict "a" "av2" ) }}
Partial cached1: {{ partialCached "p1" "input1" $key1 }}
Partial cached2: {{ partialCached "p1" "input2" $key1 }}
Partial cached3: {{ partialCached "p1" "input3" $key2 }}
-- layouts/partials/p1.html --
-- layouts/_partials/p1.html --
partial: {{ . }}
`
b := NewIntegrationTestBuilder(
@@ -399,7 +399,7 @@ func TestTemplateTruth(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ $p := index site.RegularPages 0 }}
{{ $zero := $p.ExpiryDate }}
{{ $notZero := time.Now }}
@@ -438,7 +438,7 @@ func TestTemplateGoIssues(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "http://example.com/"
-- layouts/index.html --
-- layouts/home.html --
{{ $title := "a & b" }}
<script type="application/ld+json">{"@type":"WebPage","headline":"{{$title}}"}</script>
@@ -483,7 +483,7 @@ func TestPartialInline(t *testing.T) {
-- hugo.toml --
baseURL = "http://example.com/"
-- content/p1.md --
-- layouts/index.html --
-- layouts/home.html --
{{ $p1 := partial "p1" . }}
{{ $p2 := partial "p2" . }}
@@ -522,7 +522,7 @@ baseURL = "http://example.com/"
-- layouts/baseof.html --
{{ $p3 := partial "p3" . }}P3: {{ $p3 }}
{{ block "main" . }}{{ end }}{{ define "partials/p3" }}Inline: p3{{ end }}
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
{{ $p1 := partial "p1" . }}
@@ -570,17 +570,17 @@ baseURL = "http://example.com/"
title: P
---
Content
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
::Header Start:{{ block "header" . }}{{ end }}:Header End:
::{{ block "main" . }}Main{{ end }}::
-- layouts/index.html --
-- layouts/home.html --
{{ define "header" }}
Home Header
{{ end }}
{{ define "main" }}
This is home main
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
This is single main
{{ end }}
@@ -614,7 +614,7 @@ func TestApplyWithNamespace(t *testing.T) {
-- hugo.toml --
baseURL = "http://example.com/"
-- content/p1.md --
-- layouts/index.html --
-- layouts/home.html --
{{ $b := slice " a " " b " " c" }}
{{ $a := apply $b "strings.Trim" "." " " }}
a: {{ $a }}
@@ -635,7 +635,7 @@ func TestOverrideInternalTemplate(t *testing.T) {
files := `
-- hugo.toml --
baseURL = "https://example.org"
-- layouts/index.html --
-- layouts/home.html --
{{ template "_internal/google_analytics_async.html" . }}
-- layouts/_internal/google_analytics_async.html --
Overridden.

View File

@@ -48,7 +48,7 @@ export default function Main() {};
console.log("Hello, Runner!");
-- node_modules/mylib/index.js --
console.log("Hello, My Lib!");
-- layouts/shortcodes/hdx.html --
-- layouts/_shortcodes/hdx.html --
{{ $path := .Get "r" }}
{{ $r := or (.Page.Resources.Get $path) (resources.Get $path) }}
{{ $batch := (js.Batch "mybatch") }}
@@ -74,7 +74,7 @@ console.log("Hello, My Lib!");
{{ end }}
{{ end }}
hdx-instance: {{ $scriptID }}: {{ $instanceID }}|
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Base.
{{ $batch := (js.Batch "mybatch") }}
{{ with $batch.Config }}
@@ -95,7 +95,7 @@ Defer:
{{ end }}
{{ block "main" . }}Main{{ end }}
End.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
==> Single Template Content: {{ .Content }}$
{{ $batch := (js.Batch "mybatch") }}
@@ -111,7 +111,7 @@ End.
{{ end }}
{{ end }}
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
Home.
{{ end }}
@@ -172,7 +172,7 @@ func TestBatchEditInstance(t *testing.T) {
files := jsBatchFilesTemplate
b := hugolib.TestRunning(t, files, hugolib.TestOptWithOSFs())
b.AssertFileContent("public/mybatch/mygroup.js", "Instance 1")
b.EditFileReplaceAll("layouts/_default/single.html", "Instance 1", "Instance 1 Edit").Build()
b.EditFileReplaceAll("layouts/single.html", "Instance 1", "Instance 1 Edit").Build()
b.AssertFileContent("public/mybatch/mygroup.js", "Instance 1 Edit")
}
@@ -180,7 +180,7 @@ func TestBatchEditScriptParam(t *testing.T) {
files := jsBatchFilesTemplate
b := hugolib.TestRunning(t, files, hugolib.TestOptWithOSFs())
b.AssertFileContent("public/mybatch/mygroup.js", "param-p1-main")
b.EditFileReplaceAll("layouts/_default/single.html", "param-p1-main", "param-p1-main-edited").Build()
b.EditFileReplaceAll("layouts/single.html", "param-p1-main", "param-p1-main-edited").Build()
b.AssertFileContent("public/mybatch/mygroup.js", "param-p1-main-edited")
}
@@ -207,7 +207,7 @@ console.log("Hello, Main!");
console.log("Hello, Runner!");
-- node_modules/mylib/index.js --
console.log("Hello, My Lib!");
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $batch := (js.Batch "mybatch") }}
{{ with $batch.Config }}
@@ -291,7 +291,7 @@ console.log("Hello, Main!");
console.log("Hello, Runner!");
-- node_modules/mylib/index.js --
console.log("Hello, My Lib!");
-- layouts/shortcodes/hdx.html --
-- layouts/_shortcodes/hdx.html --
{{ $path := .Get "r" }}
{{ $r := or (.Page.Resources.Get $path) (resources.Get $path) }}
{{ $batch := (js.Batch "mybatch") }}
@@ -317,7 +317,7 @@ console.log("Hello, My Lib!");
{{ end }}
{{ end }}
hdx-instance: {{ $scriptID }}: {{ $instanceID }}|
-- layouts/_default/baseof.html --
-- layouts/baseof.html --
Base.
{{ $batch := (js.Batch "mybatch") }}
{{ with $batch.Config }}
@@ -338,7 +338,7 @@ Defer:
{{ end }}
{{ block "main" . }}Main{{ end }}
End.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ define "main" }}
==> Single Template Content: {{ .Content }}$
{{ $batch := (js.Batch "mybatch") }}
@@ -354,7 +354,7 @@ End.
{{ end }}
{{ end }}
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
Home.
{{ end }}
@@ -584,7 +584,7 @@ console.log('config.params.id', config.id)
export default function Main3() {};
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
{{ $r := .Resources.GetMatch "*.jsx" }}
@@ -612,7 +612,7 @@ Single.
{{ .SetOptions (dict "title" "r2 instance 1")}}
{{ end }}
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ with (templates.Defer (dict "key" "global")) }}
{{ $batch := (js.Batch "mybundle") }}

View File

@@ -40,7 +40,7 @@ other = 'l1theme'
other = 'l2theme'
[l3]
other = 'l3theme'
-- layouts/index.html --
-- layouts/home.html --
l1: {{ i18n "l1" }}|l2: {{ i18n "l2" }}|l3: {{ i18n "l3" }}
`
@@ -83,7 +83,7 @@ Irure excepteur ex occaecat ipsum laboris fugiat exercitation. Exercitation adip
-- i18n/en.toml --
[a]
other = 'Reading time: {{ .ReadingTime }}'
-- layouts/index.html --
-- layouts/home.html --
i18n: {{ i18n "a" . }}|
`
@@ -110,7 +110,7 @@ defaultContentLanguageInSubdir = true
cat = 'gato'
-- i18n/fr.toml --
# this file intentionally empty
-- layouts/index.html --
-- layouts/home.html --
{{ .Title }}_{{ T "cat" }}
-- content/_index.fr.md --
---

View File

@@ -36,6 +36,12 @@ import (
)
func TestCommands(t *testing.T) {
// These are somewhat flakey and takes some time,
// so usefule to have a way to skip them when developing.
const skipEnv = "HUGOTESTING_SKIP_COMMANDS"
if os.Getenv(skipEnv) != "" {
t.Skipf("skip because %s set in env", skipEnv)
}
p := commonTestScriptsParam
p.Dir = "testscripts/commands"
testscript.Run(t, p)

View File

@@ -32,9 +32,9 @@ func TestBlockquoteHook(t *testing.T) {
[markup.goldmark.parser.attribute]
block = true
title = true
-- layouts/_default/_markup/render-blockquote.html --
-- layouts/_markup/render-blockquote.html --
Blockquote: |{{ .Text }}|{{ .Type }}|
-- layouts/_default/_markup/render-blockquote-alert.html --
-- layouts/_markup/render-blockquote-alert.html --
{{ $text := .Text }}
Blockquote Alert: |{{ $text }}|{{ .Type }}|
Blockquote Alert Attributes: |{{ $text }}|{{ .Attributes }}|
@@ -42,7 +42,7 @@ Blockquote Alert Page: |{{ $text }}|{{ .Page.Title }}|{{ .PageInner.Title }}|
{{ if .Attributes.showpos }}
Blockquote Alert Position: |{{ $text }}|{{ .Position | safeHTML }}|
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
Content: {{ .Content }}
-- content/p1.md --
---
@@ -98,7 +98,7 @@ title: "p1"
---
>
-- layouts/_default/single.html --
-- layouts/single.html --
Content: {{ .Content }}
`
@@ -135,9 +135,9 @@ title: "Home"
> > [!important] Yes!, they can.
> > > [!tip] You can even use multiple layers of nesting.
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
-- layouts/_default/_markup/render-blockquote.html --
-- layouts/_markup/render-blockquote.html --
AlertType: {{ .AlertType }}|AlertTitle: {{ .AlertTitle }}|AlertSign: {{ .AlertSign | safeHTML }}|Text: {{ .Text }}|
`
@@ -163,9 +163,9 @@ func TestBlockquoteRenderHookTextParsing(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
-- layouts/_default/_markup/render-blockquote.html --
-- layouts/_markup/render-blockquote.html --
AlertType: {{ .AlertType }}|AlertTitle: {{ .AlertTitle }}|Text: {{ .Text }}|
-- content/_index.md --
---

View File

@@ -41,14 +41,14 @@ func TestCodeblocks(t *testing.T) {
noClasses = false
style = 'monokai'
tabWidth = 4
-- layouts/_default/_markup/render-codeblock-goat.html --
-- layouts/_markup/render-codeblock-goat.html --
{{ $diagram := diagrams.Goat .Inner }}
Goat SVG:{{ substr $diagram.Wrapped 0 100 | safeHTML }} }}|
Goat Attribute: {{ .Attributes.width}}|
-- layouts/_default/_markup/render-codeblock-go.html --
-- layouts/_markup/render-codeblock-go.html --
Go Code: {{ .Inner | safeHTML }}|
Go Language: {{ .Type }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/p1.md --
---
@@ -130,11 +130,11 @@ lineNumbersInTable = true
noClasses = false
style = 'monokai'
tabWidth = 4
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
{{ $result := transform.HighlightCodeBlock . }}
Inner: |{{ $result.Inner | safeHTML }}|
Wrapped: |{{ $result.Wrapped | safeHTML }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/p1.md --
---
@@ -162,9 +162,9 @@ func TestCodeblocksBugs(t *testing.T) {
files := `
-- config.toml --
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
{{ .Position | safeHTML }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/p1.md --
---
@@ -201,9 +201,9 @@ title: "p1"
§§§bash
echo "p1";
§§§
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
|{{ .Inner | safeHTML }}|
`
@@ -228,9 +228,9 @@ title: "p1"
§§§
echo "p1";
§§§
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
Position: {{ .Position | safeHTML }}
@@ -258,9 +258,9 @@ title: "p1"
Hello, World!
§§§
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
Attributes: {{ .Attributes }}|Type: {{ .Type }}|
`
@@ -285,9 +285,9 @@ title: "p1"
§§§LANGUAGE {style=monokai}
echo "p1";
§§§
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
Attributes: {{ .Attributes }}|Options: {{ .Options }}|
@@ -327,7 +327,7 @@ BLOCK
Common
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
@@ -371,10 +371,10 @@ title: "p1"
Hello, World!
§§§
-- layouts/index.html --
-- layouts/_default/single.html --
-- layouts/home.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
Attributes: {{ .Attributes }}|Type: {{ .Type }}|
`

View File

@@ -46,7 +46,7 @@ title: "p1"
~~~bash {id="c" onmouseover="alert('code fence')" LINENOS=true}
foo
~~~
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -69,9 +69,9 @@ func TestAttributeExclusionWithRenderHook(t *testing.T) {
title: "p1"
---
## Heading {onclick="alert('renderhook')" data-foo="bar"}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
<h{{ .Level }}
{{- range $k, $v := .Attributes -}}
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
@@ -95,7 +95,7 @@ func TestAttributesDefaultRenderer(t *testing.T) {
title: "p1"
---
## Heading Attribute Which Needs Escaping { class="a < b" }
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -116,10 +116,10 @@ func TestAttributesHookNoEscape(t *testing.T) {
title: "p1"
---
## Heading Attribute Which Needs Escaping { class="Smith & Wesson" }
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
plain: |{{- range $k, $v := .Attributes -}}{{ $k }}: {{ $v }}|{{ end }}|
safeHTML: |{{- range $k, $v := .Attributes -}}{{ $k }}: {{ $v | safeHTML }}|{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -142,14 +142,14 @@ func TestLinkInTitle(t *testing.T) {
title: "p1"
---
## Hello [Test](https://example.com)
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
`
@@ -179,7 +179,7 @@ lineNumbersInTable = true
noClasses = false
style = 'monokai'
tabWidth = 4
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/p1.md --
---
@@ -234,14 +234,14 @@ LINE8
func BenchmarkRenderHooks(b *testing.B) {
files := `
-- config.toml --
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text }}
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
</h{{ .Level }}>
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text }}</a>
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -303,7 +303,7 @@ func BenchmarkCodeblocks(b *testing.B) {
noClasses = true
style = 'monokai'
tabWidth = 4
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -348,7 +348,7 @@ FENCE
b.Run("Hook no higlight", func(b *testing.B) {
files := filesTemplate + `
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
{{ .Inner }}
`
@@ -364,9 +364,9 @@ func TestHookInfiniteRecursion(t *testing.T) {
t.Run(renderFunc, func(t *testing.T) {
files := `
-- config.toml --
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}">{{ .Text | RENDERFUNC }}</a>
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- content/p1.md --
---
@@ -408,7 +408,7 @@ func TestQuotesInImgAltAttr(t *testing.T) {
title: "p1"
---
!["a"](b.jpg)
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -437,13 +437,13 @@ Link no procol: www.example.org
Link http procol: http://www.example.org
Link https procol: https://www.example.org
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
files = strings.ReplaceAll(files, "PROTOCOL", protocol)
if withHook {
files += `-- layouts/_default/_markup/render-link.html --
files += `-- layouts/_markup/render-link.html --
<a href="{{ .Destination | safeURL }}">{{ .Text }}</a>`
}
@@ -505,7 +505,7 @@ a <!-- b --> c
- This is a list item <!-- Comment: an innocent-looking comment -->
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -539,7 +539,7 @@ title: "p1"
![A's is > than B's](some-image.png)
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -581,16 +581,16 @@ title: "p1"
title: "p2"
---
:heavy_check_mark:
-- layouts/shortcodes/include.html --
-- layouts/_shortcodes/include.html --
{{ $p := site.GetPage (.Get 0) }}
{{ $p.RenderShortcodes }}
-- layouts/shortcodes/sc1.html --
-- layouts/_shortcodes/sc1.html --
sc1_begin|{{ .Inner }}|sc1_end
-- layouts/shortcodes/sc2.html --
-- layouts/_shortcodes/sc2.html --
sc2_begin|{{ .Inner | .Page.RenderString }}|sc2_end
-- layouts/shortcodes/sc3.html --
-- layouts/_shortcodes/sc3.html --
sc3_begin|{{ .Inner }}|sc3_end
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -621,7 +621,7 @@ enableEmoji = false
title: "p1"
---
:x:
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -639,7 +639,7 @@ func TestEmojiDefaultConfig(t *testing.T) {
title: "p1"
---
:x:
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -658,7 +658,7 @@ func TestGoldmarkTemplateDelims(t *testing.T) {
minifyOutput = true
[minify.tdewolff.html]
templateDelims = ["<?php","?>"]
-- layouts/index.html --
-- layouts/home.html --
<div class="foo">
{{ safeHTML "<?php" }}
echo "hello";
@@ -688,7 +688,7 @@ title: "p1"
Inline equation that would be mangled by default parser: $a^*=x-b^*$
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -717,7 +717,7 @@ Block equation that would be mangled by default parser:
$$a^*=x-b^*$$
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -752,7 +752,7 @@ Block equation that would be mangled by default parser:
a^*=x-b^*
%!%
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -788,7 +788,7 @@ enable = false
enable = false
[markup.goldmark.extensions.extras.superscript]
enable = false
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
-- content/_index.md --
---
@@ -839,7 +839,7 @@ markup.goldmark.renderer.unsafe = false
title: "p1"
---
<div>Some raw HTML</div>
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -863,7 +863,7 @@ markup.goldmark.renderer.unsafe = false
title: "p1"
---
<em>raw HTML</em>
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -931,7 +931,7 @@ hidden
--> word.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`

View File

@@ -30,13 +30,13 @@ This is an inline image: ![Inline Image](/inline.jpg). Some more text.
{.b}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
t.Run("With Hook, no wrap", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "CONFIG_VALUE", "false")
files = files + `-- layouts/_default/_markup/render-image.html --
files = files + `-- layouts/_markup/render-image.html --
{{ if .IsBlock }}
<figure class="{{ .Attributes.class }}">
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}|{{ .Ordinal }}" />
@@ -55,7 +55,7 @@ This is an inline image: ![Inline Image](/inline.jpg). Some more text.
t.Run("With Hook, wrap", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "CONFIG_VALUE", "true")
files = files + `-- layouts/_default/_markup/render-image.html --
files = files + `-- layouts/_markup/render-image.html --
{{ if .IsBlock }}
<figure class="{{ .Attributes.class }}">
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />

View File

@@ -53,7 +53,7 @@ Second line
## Example [hyperlink](https://example.com/) in a header
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}|Identifiers: {{ .Fragments.Identifiers }}|
`
@@ -83,7 +83,7 @@ func TestSolitaryAttributesCrash(t *testing.T) {
-- hugo.toml --
[markup.goldmark.parser.attribute]
block = true
-- layouts/_default/single.html --
-- layouts/single.html --
Content: {{ .Content }}
-- content/p1.md --
---

View File

@@ -43,11 +43,11 @@ $$a^*=x-b^*$$
Some inline LaTeX 2: $a^*=x-b^*$.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-passthrough-block.html --
-- layouts/_markup/render-passthrough-block.html --
Passthrough block: {{ .Inner | safeHTML }}|{{ .Type }}|{{ .Ordinal }}:END
-- layouts/_default/_markup/render-passthrough-inline.html --
-- layouts/_markup/render-passthrough-inline.html --
Passthrough inline: {{ .Inner | safeHTML }}|{{ .Type }}|{{ .Ordinal }}:END
`

View File

@@ -45,9 +45,9 @@ title = true
| February | $80 |
| March | $420 |
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
-- layouts/_default/_markup/render-table.html --
-- layouts/_markup/render-table.html --
Attributes: {{ .Attributes }}|
{{ template "print" (dict "what" (printf "table-%d-thead" $.Ordinal) "rows" .THead) }}
{{ template "print" (dict "what" (printf "table-%d-tbody" $.Ordinal) "rows" .TBody) }}
@@ -99,7 +99,7 @@ a|b
1|2
{id="\"><script>alert()</script>"}
-- layouts/_default/single.html --
-- layouts/single.html --
Summary: {{ .Summary }}
Content: {{ .Content }}
@@ -135,13 +135,13 @@ output: ["rss", "html"]
{{< foo >}}
-- layouts/index.html --
-- layouts/home.html --
Content: {{ .Content }}
-- layouts/index.xml --
Content: {{ .Content }}
-- layouts/shortcodes/foo.xml --
-- layouts/_shortcodes/foo.xml --
foo xml
-- layouts/shortcodes/foo.html --
-- layouts/_shortcodes/foo.html --
foo html
`

View File

@@ -46,7 +46,7 @@ autoHeadingIDType = 'github'
[markup.goldmark.renderer]
unsafe = false
xhtml = false
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .TableOfContents }}
-- content/p1.md --
---
@@ -180,7 +180,7 @@ autoHeadingIDType = 'github'
[markup.goldmark.renderer]
unsafe = true
xhtml = true
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .TableOfContents }}
-- content/p1.md --
---
@@ -290,9 +290,9 @@ func TestIssue13416(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
Content:{{ .Content }}|
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
-- content/_index.md --
---
title: home

View File

@@ -59,11 +59,11 @@ Not sure if this makes sense, but add a test for it:
§§§
-- layouts/_default/_markup/render-codeblock-html.html --
-- layouts/_markup/render-codeblock-html.html --
{{ $opts := dict "hl_inline" true }}
{{ $result := transform.HighlightCodeBlock . $opts }}
HighlightCodeBlock: Wrapped:{{ $result.Wrapped }}|Inner:{{ $result.Inner }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -93,7 +93,7 @@ title: home
§§§go
xəx := 0
§§§
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
`
@@ -119,7 +119,7 @@ title: home
§§§go
xəx := 0
§§§
-- layouts/index.html --
-- layouts/home.html --
{{ .Content }}
`

View File

@@ -27,7 +27,7 @@ func TestHeadingsLevel(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{ range .Fragments.HeadingsMap }}
{{ printf "%s|%d|%s" .ID .Level .Title }}
{{ end }}
@@ -52,7 +52,7 @@ func TestToHTMLArgTypes(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['home','section','rss','sitemap','taxonomy','term']
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Fragments.ToHTML .Params.toc.startLevel .Params.toc.endLevel false }}
-- content/json.md --
{

View File

@@ -90,7 +90,7 @@ keywords: ['foo']
## Common p3, p4, p5
-- layouts/shortcodes/see-also.html --
-- layouts/_shortcodes/see-also.html --
{{ $p1 := site.GetPage "p1" }}
{{ $p2 := site.GetPage "p2" }}
{{ $p3 := site.GetPage "p3" }}
@@ -108,7 +108,7 @@ Related 2: {{ template "list-related" $related2 }}
{{ define "list-related" }}{{ range $i, $e := . }} {{ $i }}: {{ .Title }}: {{ with .HeadingsFiltered}}{{ range $i, $e := .}}h{{ $i }}: {{ .Title }}|{{ .ID }}|{{ end }}{{ end }}::END{{ end }}{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
Content: {{ .Content }}
@@ -149,7 +149,7 @@ disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT"]
name = 'pagerefs'
type = 'fragments'
weight = 30
-- layouts/_default/single.html --
-- layouts/single.html --
Len related: {{ site.RegularPages.Related . | len }}
`

View File

@@ -40,7 +40,7 @@ sourcefilename: ../testdata/exif/orientation6.jpg
sourcefilename: ../testdata/sunset.jpg
-- assets/gopher.png --
sourcefilename: ../testdata/gopher-hero8.png
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := (resources.Get "sunset.jpg").Resize "x300" }}
{{ $sunsetGrayscale := $sunset.Filter (images.Grayscale) }}
@@ -120,7 +120,7 @@ sourcefilename: ../testdata/sunset.jpg
-- assets/mask.png --
sourcefilename: ../testdata/mask.png
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := resources.Get "sunset.jpg" }}
{{ $mask := resources.Get "mask.png" }}
@@ -184,7 +184,7 @@ sourcefilename: ../testdata/sunset.jpg
-- assets/mask.png --
sourcefilename: ../testdata/mask.png
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := resources.Get "sunset.jpg" }}
{{ $mask := resources.Get "mask.png" }}
@@ -244,7 +244,7 @@ func TestImagesGoldenFiltersText(t *testing.T) {
-- assets/sunset.jpg --
sourcefilename: ../testdata/sunset.jpg
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := resources.Get "sunset.jpg" }}
{{ $textOpts := dict
@@ -308,7 +308,7 @@ sourcefilename: ../testdata/giphy.gif
sourcefilename: ../testdata/sunset.jpg
-- assets/gopher.png --
sourcefilename: ../testdata/gopher-hero8.png
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := resources.Get "sunset.jpg" }}
{{ $sunsetGrayscale := $sunset.Filter (images.Grayscale) }}
@@ -364,7 +364,7 @@ sourcefilename: ../testdata/sunset.jpg
-- assets/gopher.png --
sourcefilename: ../testdata/gopher-hero8.png
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $sunset := resources.Get "sunset.jpg" }}
{{ $gopher := resources.Get "gopher.png" }}

View File

@@ -24,7 +24,7 @@ func TestAutoOrient(t *testing.T) {
-- hugo.toml --
-- assets/rotate270.jpg --
sourcefilename: ../testdata/exif/orientation6.jpg
-- layouts/index.html --
-- layouts/home.html --
{{ $img := resources.Get "rotate270.jpg" }}
W/H original: {{ $img.Width }}/{{ $img.Height }}
{{ $rotated := $img.Filter images.AutoOrient }}
@@ -41,7 +41,7 @@ func TestOrientationEq(t *testing.T) {
-- hugo.toml --
-- assets/rotate270.jpg --
sourcefilename: ../testdata/exif/orientation6.jpg
-- layouts/index.html --
-- layouts/home.html --
{{ $img := resources.Get "rotate270.jpg" }}
{{ $orientation := $img.Exif.Tags.Orientation }}
Orientation: {{ $orientation }}|eq 6: {{ eq $orientation 6 }}|Type: {{ printf "%T" $orientation }}|

View File

@@ -54,7 +54,7 @@ date: "2020-01-01"
title: "Post 2"
date: "2020-02-01"
---
-- layouts/index.html --
-- layouts/home.html --
{{ range $k, $v := site.RegularPages.GroupByDate "January, 2006" }}{{ $k }}|{{ $v.Key }}|{{ $v.Pages }}{{ end }}
`
@@ -104,7 +104,7 @@ title: "alpha"
date: "2020-01-01"
param1: "éclair"
---
-- layouts/index.html --
-- layouts/home.html --
ByTitle: {{ range site.RegularPages.ByTitle }}{{ .Title }}|{{ end }}
ByLinkTitle: {{ range site.RegularPages.ByLinkTitle }}{{ .Title }}|{{ end }}
ByParam: {{ range site.RegularPages.ByParam "param1" }}{{ .Params.param1 }}|{{ end }}
@@ -159,7 +159,7 @@ title: "D"
slug: "d"
---
D
-- layouts/_default/single.html --
-- layouts/single.html --
RelPermalink: {{ .RelPermalink }}
`

View File

@@ -35,7 +35,7 @@ title: "Post 1"
date: "2020-01-01"
---
{{% foo %}}
-- layouts/shortcodes/foo.html --
-- layouts/_shortcodes/foo.html --
Two *words*.
{{/* Test that markup scope is set in all relevant constructs. */}}
{{ if eq hugo.Context.MarkupScope "foo" }}
@@ -45,10 +45,10 @@ Sint ad mollit qui Lorem ut occaecat culpa officia. Et consectetur aute voluptat
### Heading 2
Exercitation quis est consectetur occaecat nostrud. Ullamco aute mollit aliqua est amet. Exercitation ullamco consectetur dolor labore et non irure eu cillum Lorem.
{{ end }}
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ .Content }}
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
Page.ContentWithoutSummmary: {{ .ContentWithoutSummary }}|
{{ template "render-scope" (dict "page" . "scope" "main") }}
@@ -134,28 +134,28 @@ date: "2020-01-03"
{{< foo >}}
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ with site.GetPage "p1" }}
{{ with .Markup "home" }}
{{ .Render.Content }}
{{ end }}
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
{{ with .Markup }}
{{ with .Render }}
{{ .Content }}
{{ end }}
{{ end }}
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
Render heading: title: {{ .Text}} scope: {{ hugo.Context.MarkupScope }}|
-- layouts/shortcodes/foo.html --
-- layouts/_shortcodes/foo.html --
Foo scope: {{ hugo.Context.MarkupScope }}|
-- layouts/shortcodes/includerendershortcodes.html --
-- layouts/_shortcodes/includerendershortcodes.html --
{{ $p := site.GetPage (.Get 0) }}
includerendershortcodes: {{ hugo.Context.MarkupScope }}|{{ $p.Markup.RenderShortcodes }}|
-- layouts/shortcodes/includecontent.html --
-- layouts/_shortcodes/includecontent.html --
{{ $p := site.GetPage (.Get 0) }}
includecontent: {{ hugo.Context.MarkupScope }}|{{ $p.Markup.Render.Content }}|
@@ -204,7 +204,7 @@ date: "2020-01-01"
summary: "This is summary in front matter."
---
This is content.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
Page.Summary: {{ .Summary }}|
{{ with .Markup.Render }}
@@ -265,7 +265,7 @@ Another paragraph.
This is summary.
<!--more-->
This is content.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
Page.Summary: {{ .Summary }}|
{{ with .Markup.Render }}
@@ -317,7 +317,7 @@ Another paragraph.
This is summary.
<!--more-->
This is content.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
Page.Summary: {{ .Summary }}|
{{ with .Markup.Render }}

View File

@@ -29,7 +29,7 @@ timeZone = "Europe/London"
title: p1
date: 2024-03-13T06:00:00
---
-- layouts/_default/single.html --
-- layouts/single.html --
Date: {{ .Date }}
Lastmod: {{ .Lastmod }}
Eq: {{ eq .Date .Lastmod }}
@@ -53,7 +53,7 @@ func TestDateValidation(t *testing.T) {
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- content/_index.md --
FRONT_MATTER
-- layouts/index.html --
-- layouts/home.html --
{{ .Date.UTC.Format "2006-01-02" }}
--
`

View File

@@ -38,7 +38,7 @@ weight: 20
title: "Page 3"
weight: 30
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|Next: {{ with .Next}}{{ .Title}}{{ end }}|Prev: {{ with .Prev}}{{ .Title}}{{ end }}|NextInSection: {{ with .NextInSection}}{{ .Title}}{{ end }}|PrevInSection: {{ with .PrevInSection}}{{ .Title}}{{ end }}|
`

View File

@@ -31,9 +31,9 @@ func TestHashSignInPermalink(t *testing.T) {
disableKinds = ['section','rss','sitemap','taxonomy']
[permalinks]
s1 = '/:section/:slug'
-- layouts/_default/list.html --
-- layouts/list.html --
{{ range site.Pages }}{{ .RelPermalink }}|{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
-- content/s1/p1.md --
---

View File

@@ -27,9 +27,9 @@ func TestPermalinks(t *testing.T) {
t.Parallel()
files := `
-- layouts/_default/list.html --
-- layouts/list.html --
List|{{ .Kind }}|{{ .RelPermalink }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single|{{ .Kind }}|{{ .RelPermalink }}|
-- hugo.toml --
[taxonomies]
@@ -148,9 +148,9 @@ func TestPermalinksOldSetup(t *testing.T) {
t.Parallel()
files := `
-- layouts/_default/list.html --
-- layouts/list.html --
List|{{ .Kind }}|{{ .RelPermalink }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single|{{ .Kind }}|{{ .RelPermalink }}|
-- hugo.toml --
[permalinks]
@@ -212,9 +212,9 @@ title: 2023
---
title: Book 1
---
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
-- layouts/_default/list.html --
-- layouts/list.html --
List.
`
@@ -261,9 +261,9 @@ title: 2023
---
title: Book One
---
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
-- layouts/_default/list.html --
-- layouts/list.html --
List.
`
@@ -287,9 +287,9 @@ func TestPermalinksUrlCascade(t *testing.T) {
t.Parallel()
files := `
-- layouts/_default/list.html --
-- layouts/list.html --
List|{{ .Kind }}|{{ .RelPermalink }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single|{{ .Kind }}|{{ .RelPermalink }}|
-- hugo.toml --
-- content/cooking/delicious-recipes/_index.md --
@@ -350,9 +350,9 @@ url: "/a\\:b/:slug/"
---
title: p2
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}
`
@@ -380,7 +380,7 @@ b = "/:sections/:contentbasename/"
{{ $.AddPage (dict "kind" "page" "path" "a/b/contentbasename2" "slug" "myslug" "title" "My A Page With Slug") }}
{{ $.AddPage (dict "kind" "section" "path" "b/c" "title" "My B Section") }}
{{ $.AddPage (dict "kind" "page" "path" "b/c/contentbasename3" "title" "My B Page No Slug") }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .RelPermalink }}|{{ .Kind }}|
`
b := hugolib.Test(t, files)
@@ -414,9 +414,9 @@ categories: ["c1", "c2"]
title: "C2"
slug: "c2slug"
---
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|{{ .RelPermalink }}|{{ .Kind }}|
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}|{{ .RelPermalink }}|{{ .Kind }}|
`
b := hugolib.Test(t, files)
@@ -480,9 +480,9 @@ title: Bar
---
title: Some Page
---
-- layouts/_default/list.html --
-- layouts/list.html --
List|{{ .Kind }}|{{ .RelPermalink }}|
-- layouts/_default/single.html --
-- layouts/single.html --
Single|{{ .Kind }}|{{ .RelPermalink }}|
`

View File

@@ -34,7 +34,7 @@ weight = 1
[languages.de]
languageName = 'Deutsch'
weight = 2
-- layouts/index.html --
-- layouts/home.html --
{{ .Site.Sites.Default.Language.LanguageName }}
`

View File

@@ -27,12 +27,12 @@ func TestTaxonomiesGetAndCount(t *testing.T) {
disableKinds = ['rss','sitemap']
[taxonomies]
author = 'authors'
-- layouts/_default/home.html --
-- layouts/home.html --
John Smith count: {{ site.Taxonomies.authors.Count "John Smith" }}
Robert Jones count: {{ (site.Taxonomies.authors.Get "Robert Jones").Pages.Len }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}|
-- layouts/_default/list.html --
-- layouts/list.html --
{{ .Title }}|
-- content/p1.md --
---
@@ -68,10 +68,10 @@ category = 'categories'
title: p1
tags: [tag-a]
---
-- layouts/_default/list.html --
-- layouts/list.html --
{{- with site.Taxonomies.tags.Page }}{{ .RelPermalink }}{{ end }}|
{{- with site.Taxonomies.categories.Page }}{{ .RelPermalink }}{{ end }}|
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Title }}
`

View File

@@ -38,7 +38,7 @@ title: "My Bundle"
Text 1.
-- content/mybundle/sub/txt2.txt --
Text 1.
-- layouts/index.html --
-- layouts/home.html --
{{ $mybundle := site.GetPage "mybundle" }}
{{ $subResources := resources.Match "/text/sub/*.*" }}
{{ $subResourcesMount := $subResources.Mount "/text/sub" "/newroot" }}
@@ -83,7 +83,7 @@ resources:
Text 1.
-- content/mybundle/foo/txt2.txt --
Text 2.
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
{{ $mybundle := site.GetPage "mybundle" }}
Resources:{{ range $mybundle.Resources }}Name: {{ .Name }}|{{ end }}$

View File

@@ -31,7 +31,7 @@ func TestGetRemoteHead(t *testing.T) {
[security.http]
methods = ['(?i)GET|POST|HEAD']
urls = ['.*gohugo\.io.*']
-- layouts/index.html --
-- layouts/home.html --
{{ $url := "https://gohugo.io/img/hugo.png" }}
{{ $opts := dict "method" "head" }}
{{ with try (resources.GetRemote $url $opts) }}
@@ -67,7 +67,7 @@ func TestGetRemoteResponseHeaders(t *testing.T) {
[security.http]
methods = ['(?i)GET|POST|HEAD']
urls = ['.*gohugo\.io.*']
-- layouts/index.html --
-- layouts/home.html --
{{ $url := "https://gohugo.io/img/hugo.png" }}
{{ $opts := dict "method" "head" "responseHeaders" (slice "X-Frame-Options" "Server") }}
{{ with try (resources.GetRemote $url $opts) }}
@@ -121,7 +121,7 @@ timeout = "TIMEOUT"
[security.http]
urls = ['.*']
mediaTypes = ['text/plain']
-- layouts/_default/single.html --
-- layouts/single.html --
{{ $url := printf "%s%s" "URL" .RelPermalink}}
{{ $opts := dict }}
{{ with try (resources.GetRemote $url $opts) }}

View File

@@ -52,7 +52,7 @@ disablekinds = ['taxonomy', 'term', 'page']
[security]
[security.exec]
allow = ['^npx$', '^babel$']
-- layouts/index.html --
-- layouts/home.html --
{{ $options := dict "noComments" true }}
{{ $transpiled := resources.Get "js/main.js" | babel -}}
Transpiled: {{ $transpiled.Content | safeJS }}

View File

@@ -68,7 +68,7 @@ hello:
-- i18n/fr.yaml --
hello:
other: "Bonjour"
-- layouts/index.html --
-- layouts/home.html --
{{ $options := dict "inlineImports" true }}
{{ $styles := resources.Get "css/styles.css" | css.PostCSS $options }}
Styles RelPermalink: {{ $styles.RelPermalink }}

View File

@@ -55,7 +55,7 @@ func TestTailwindV4Basic(t *testing.T) {
--color-neon-lime: oklch(91.5% 0.258 129);
--color-neon-cyan: oklch(91.3% 0.139 195.8);
}
-- layouts/index.html --
-- layouts/home.html --
{{ $css := resources.Get "css/styles.css" | css.TailwindCSS }}
CSS: {{ $css.Content | safeCSS }}|
`

View File

@@ -49,7 +49,7 @@ export function hello2() {
export function hello3() {
return 'efgh';
}
-- layouts/index.html --
-- layouts/home.html --
{{ $js := resources.Get "js/main.js" | js.Build }}
JS Content:{{ $js.Content }}:End:
@@ -175,7 +175,7 @@ hello:
-- i18n/fr.yaml --
hello:
other: "Bonjour"
-- layouts/index.html --
-- layouts/home.html --
{{ $options := dict "minify" false "externals" (slice "react" "react-dom") "sourcemap" "linked" }}
{{ $js := resources.Get "js/main.js" | js.Build $options }}
JS: {{ template "print" $js }}
@@ -257,7 +257,7 @@ export function hello2() {
export function hello3() {
return 'efgh';
}
-- layouts/index.html --
-- layouts/home.html --
{{ $js := resources.Get "js/main.js" | js.Build }}
JS Content:{{ $js.Content }}:End:
@@ -297,7 +297,7 @@ console.log("IMPORT_SRC_DIR:imp3/foo.ts");
import 'imp1/index.js';
import 'imp2/index.js';
import 'imp3/foo.js';
-- layouts/index.html --
-- layouts/home.html --
{{ $js := resources.Get "js/main.js" | js.Build }}
{{ $js.RelPermalink }}
`
@@ -343,7 +343,7 @@ console.log("Hello 1");
-- assets/js/utils/util2.js --
//! License util2 */
console.log("Hello 2");
-- layouts/index.html --
-- layouts/home.html --
{{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false) }}
{{ $js.RelPermalink }}
`
@@ -379,7 +379,7 @@ disableKinds = ['RSS','sitemap','taxonomy','term']
function addFoo(target: any) {target.prototype.foo = 'bar'}
@addFoo
class A {}
-- layouts/index.html --
-- layouts/home.html --
{{ $opts := dict "target" "es2020" "targetPath" "js/main.js" }}
{{ (resources.Get "ts/main.ts" | js.Build $opts).Publish }}
`
@@ -409,7 +409,7 @@ import { hello2 } from './util2.js';
hello1();
hello2();
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $js := resources.Get "js/main.js" | js.Build (dict "externals" (slice "./util1.js")) }}
{{ $js.Publish }}

View File

@@ -28,7 +28,7 @@ func TestTransformMinify(t *testing.T) {
-- assets/js/test.js --
new Date(2002, 04, 11)
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $js := resources.Get "js/test.js" | minify }}
<script>
{{ $js.Content }}

View File

@@ -42,14 +42,14 @@ other = "Hello"
-- i18n/fr.toml --
[hello]
other = "Bonjour"
-- layouts/index.fr.html --
-- layouts/home.fr.html --
Lang: {{ site.Language.Lang }}
{{ $templ := "{{T \"hello\"}}" | resources.FromString "f1.html" }}
{{ $helloResource := $templ | resources.ExecuteAsTemplate (print "f%s.html" .Lang) . }}
Hello1: {{T "hello"}}
Hello2: {{ $helloResource.Content }}
LangURL: {{ relLangURL "foo" }}
-- layouts/index.html --
-- layouts/home.html --
Lang: {{ site.Language.Lang }}
{{ $templ := "{{T \"hello\"}}" | resources.FromString "f1.html" }}
{{ $helloResource := $templ | resources.ExecuteAsTemplate (print "f%s.html" .Lang) . }}

View File

@@ -40,7 +40,7 @@ moo {
color: $moolor;
}
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo") "transpiler" "dartsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -81,7 +81,7 @@ moo {
-- assets/scss/regular.css --
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $r := resources.Get "scss/main.scss" | toCSS (dict "transpiler" "dartsass") }}
T1: {{ $r.Content | safeHTML }}
@@ -125,7 +125,7 @@ func TestTransformImportIndentedSASS(t *testing.T) {
/* foo */
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $r := resources.Get "scss/main.scss" | toCSS (dict "transpiler" "dartsass") }}
T1: {{ $r.Content | safeHTML }}
@@ -164,7 +164,7 @@ a {color: import-this-file-css;}
a {color: compile-this-mounted-file-css;}
-- foo/_import-this-mounted-file.css --
a {color: import-this-mounted-file-css;}
-- layouts/index.html --
-- layouts/home.html --
{{- $opts := dict "transpiler" "dartsass" }}
{{- with resources.Get "main.scss" | toCSS $opts }}{{ .Content | safeHTML }}{{ end }}
-- config.toml --
@@ -224,7 +224,7 @@ moo {
}
-- config.toml --
theme = 'mytheme'
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo" ) "transpiler" "dartsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -278,7 +278,7 @@ func TestTransformLogging(t *testing.T) {
-- config.toml --
disableKinds = ["term", "taxonomy", "section", "page"]
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "transpiler" "dartsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
T1: {{ $r.Content }}
@@ -325,7 +325,7 @@ body {
color: $maincolor;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := dict "transpiler" "dartsass" }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -392,7 +392,7 @@ p {
b {
color: vars.$color2;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $image := "images/hero.jpg" }}
{{ $font := "Hugo's New Roman" }}
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
@@ -442,7 +442,7 @@ p {
b {
color: vars.$color2;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $vars := site.Params.sassvars}}
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
@@ -497,7 +497,7 @@ float = 3.14
@debug meta.type-of(vars.$integer);
@debug meta.type-of(vars.$float);
@debug meta.type-of(vars.$a_number);
-- layouts/index.html --
-- layouts/home.html --
{{ $vars := site.Params.sassvars}}
{{ $vars = merge $vars (dict "not_a_number" ("32xxx" | css.Quoted) "a_number" ("234" | css.Unquoted) )}}
{{ $cssOpts := (dict "transpiler" "dartsass" "vars" $vars ) }}
@@ -547,7 +547,7 @@ path="github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
module github.com/gohugoio/tests/testHugoModules
-- assets/scss/main.scss --
@import "bootstrap/bootstrap";
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "transpiler" "dartsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
Styles: {{ $r.RelPermalink }}
@@ -580,7 +580,7 @@ target = 'assets'
[[module.mounts]]
source = "miscellaneous/sass"
target = "assets/sass"
-- layouts/index.html --
-- layouts/home.html --
{{ $opts := dict "transpiler" "dartsass" "outputStyle" "compressed" }}
{{ (resources.Get "sass/main.scss" | toCSS $opts).Content }}
-- assets/sass/main.scss --
@@ -626,7 +626,7 @@ moo {
color: $moolor;
}
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo") "transpiler" "dartsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -649,7 +649,7 @@ func TestSilenceDependencyDeprecations(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{ $opts := dict
"transpiler" "dartsass"
"outputStyle" "compressed"

View File

@@ -42,7 +42,7 @@ moo {
color: $moolor;
}
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo") ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -85,7 +85,7 @@ moo {
-- assets/scss/regular.css --
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $r := resources.Get "scss/main.scss" | toCSS }}
T1: {{ $r.Content | safeHTML }}
@@ -138,7 +138,7 @@ moo {
}
-- config.toml --
theme = 'mytheme'
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "includePaths" (slice "node_modules/foo" ) ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -208,7 +208,7 @@ body {
color: $maincolor;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := dict }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts | minify }}
T1: {{ $r.Content }}
@@ -273,7 +273,7 @@ p {
b {
color: $color2;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $image := "images/hero.jpg" }}
{{ $font := "Hugo's New Roman" }}
{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
@@ -312,7 +312,7 @@ path="github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
module github.com/gohugoio/tests/testHugoModules
-- assets/scss/main.scss --
@import "bootstrap/bootstrap";
-- layouts/index.html --
-- layouts/home.html --
{{ $cssOpts := (dict "transpiler" "libsass" ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }}
Styles: {{ $r.RelPermalink }}
@@ -340,7 +340,7 @@ func TestRebuildAssetGetMatch(t *testing.T) {
b {
color: red;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $r := resources.GetMatch "scss/main.scss" | toCSS }}
T1: {{ $r.Content }}
`
@@ -382,7 +382,7 @@ h2 {
h3 {
color: green;
}
-- layouts/index.html --
-- layouts/home.html --
{{ $a := slice (resources.Get "a.scss") }}
{{ $b := resources.Match "dir/*.scss" }}
@@ -435,7 +435,7 @@ target = 'assets'
[[module.mounts]]
source = "miscellaneous/sass"
target = "assets/sass"
-- layouts/index.html --
-- layouts/home.html --
{{ $opts := dict "transpiler" "libsass" "outputStyle" "compressed" }}
{{ (resources.Get "sass/main.scss" | toCSS $opts).Content }}
-- assets/sass/main.scss --

View File

@@ -38,7 +38,7 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA
-- content/mybundle/giphy.gif --
sourcefilename: testdata/giphy.gif
-- layouts/foo.html --
-- layouts/index.html --
-- layouts/home.html --
{{ $p := site.GetPage "mybundle"}}
{{ $img := $p.Resources.Get "pixel.png" }}
{{ $giphy := $p.Resources.Get "giphy.gif" }}
@@ -83,7 +83,7 @@ func TestSVGError(t *testing.T) {
-- config.toml --
-- assets/circle.svg --
<svg height="100" width="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>
-- layouts/index.html --
-- layouts/home.html --
{{ $svg := resources.Get "circle.svg" }}
Width: {{ $svg.Width }}
`
@@ -109,7 +109,7 @@ func TestNoPublishOfUnusedProcessedImage(t *testing.T) {
files := `
-- assets/images/pixel.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{ $image := resources.Get "images/pixel.png" }}
{{ $image = $image.Resize "400x" }}
{{ $image = $image.Resize "300x" }}
@@ -143,7 +143,7 @@ func TestProcessFilter(t *testing.T) {
files := `
-- assets/images/pixel.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{ $pixel := resources.Get "images/pixel.png" }}
{{ $filters := slice (images.GaussianBlur 6) (images.Pixelate 8) (images.Process "jpg") }}
{{ $image := $pixel.Filter $filters }}
@@ -172,7 +172,7 @@ func TestGroupByParamDate(t *testing.T) {
files := `
-- config.toml --
disableKinds = ['section','rss','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{- range site.RegularPages.GroupByParamDate "eventDate" "2006-01" }}
{{- .Key }}|{{ range .Pages }}{{ .Title }}|{{ end }}
{{- end }}
@@ -237,7 +237,7 @@ func TestImageTransformThenCopy(t *testing.T) {
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- assets/pixel.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{- with resources.Get "pixel.png" }}
{{- with .Resize "200x" | resources.Copy "pixel.png" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">|{{ .Key }}
@@ -262,7 +262,7 @@ func TestUseDifferentCacheKeyForResourceCopy(t *testing.T) {
disableKinds = ['page','section','rss','sitemap','taxonomy','term']
-- assets/a.txt --
This was assets/a.txt
-- layouts/index.html --
-- layouts/home.html --
{{ $nilResource := resources.Get "/p1/b.txt" }}
{{ $r := resources.Get "a.txt" }}
{{ $r = resources.Copy "/p1/b.txt" $r }}

View File

@@ -37,9 +37,9 @@ P1.
title: "P2"
---
P2.
-- layouts/_default/list.html --
-- layouts/list.html --
List.
-- layouts/_default/single.html --
-- layouts/single.html --
{{ $css := resources.Get "css/main.css" | resources.Minify }}
CSS: {{ $css.Content }}
`

View File

@@ -26,9 +26,9 @@ func TestApplyWithContext(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
{{ apply (seq 3) "partial" "foo.html"}}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ return "foo"}}
`
@@ -45,7 +45,7 @@ func TestSortStable(t *testing.T) {
files := `
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $values := slice (dict "a" 1 "b" 2) (dict "a" 3 "b" 1) (dict "a" 2 "b" 0) (dict "a" 1 "b" 0) (dict "a" 3 "b" 1) (dict "a" 2 "b" 2) (dict "a" 2 "b" 1) (dict "a" 0 "b" 3) (dict "a" 3 "b" 3) (dict "a" 0 "b" 0) (dict "a" 0 "b" 0) (dict "a" 2 "b" 0) (dict "a" 1 "b" 2) (dict "a" 1 "b" 1) (dict "a" 3 "b" 0) (dict "a" 2 "b" 0) (dict "a" 3 "b" 0) (dict "a" 3 "b" 0) (dict "a" 3 "b" 0) (dict "a" 3 "b" 1) }}
Asc: {{ sort (sort $values "b" "asc") "a" "asc" }}
Desc: {{ sort (sort $values "b" "desc") "a" "desc" }}
@@ -75,7 +75,7 @@ func TestAppendSliceToASliceOfSlices(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $obj := slice (slice "a") }}
{{ $obj = $obj | append (slice "b") }}
{{ $obj = $obj | append (slice "c") }}
@@ -94,7 +94,7 @@ func TestAppendNilToSlice(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $obj := (slice "a") }}
{{ $obj = $obj | append nil }}
@@ -113,7 +113,7 @@ func TestAppendNilsToSliceWithNils(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $obj := (slice "a" nil "c") }}
{{ $obj = $obj | append nil }}
@@ -143,9 +143,9 @@ func TestWhereWithWordCount(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
Home: {{ range where site.RegularPages "WordCount" "gt" 50 }}{{ .Title }}|{{ end }}
-- layouts/shortcodes/lorem.html --
-- layouts/_shortcodes/lorem.html --
{{ "ipsum " | strings.Repeat (.Get 0 | int) }}
-- content/p1.md --
@@ -191,7 +191,7 @@ foo: abc
title: P3
foo: bc
---
-- layouts/index.html --
-- layouts/home.html --
<ul>
{{- range where site.RegularPages "Params.foo" "like" "^ab" -}}
<li>{{ .Title }}</li>
@@ -227,7 +227,7 @@ title: p3
categories: [cat-a]
tags: ['tag-b']
---
-- layouts/_default/term.html --
-- layouts/term.html --
{{ $list1 := .Pages }}
{{ range $i, $e := site.Taxonomies.tags.ByCount }}
{{ $list2 := .Pages }}
@@ -257,7 +257,7 @@ func TestUnionResourcesMatch(t *testing.T) {
files := `
-- config.toml --
disableKinds = ['rss','sitemap', 'taxonomy', 'term', 'page']
-- layouts/index.html --
-- layouts/home.html --
{{ $a := resources.Match "*a*" }}
{{ $b := resources.Match "*b*" }}
{{ $union := $a | union $b }}

View File

@@ -25,7 +25,7 @@ func TestTimer(t *testing.T) {
-- hugo.toml --
baseURL = "https://example.org/"
disableKinds = ["taxonomy", "term"]
-- layouts/index.html --
-- layouts/home.html --
{{ range seq 5 }}
{{ $t := debug.Timer "foo" }}
{{ seq 1 1000 }}
@@ -61,11 +61,11 @@ date: 2012-03-15
title: "The First"
tags: ["a", "b"]
---
-- layouts/_default/list.html --
-- layouts/list.html --
Dump: {{ debug.Dump . | safeHTML }}
Dump Site: {{ debug.Dump site }}
Dum site.Taxonomies: {{ debug.Dump site.Taxonomies | safeHTML }}
-- layouts/_default/single.html --
-- layouts/single.html --
Dump: {{ debug.Dump . | safeHTML }}

View File

@@ -28,7 +28,7 @@ func TestErroridf(t *testing.T) {
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
ignoreErrors = ['error-b','error-C']
-- layouts/index.html --
-- layouts/home.html --
{{ erroridf "error-a" "%s" "a"}}
{{ erroridf "error-b" "%s" "b"}}
{{ erroridf "error-C" "%s" "C"}}
@@ -52,7 +52,7 @@ func TestWarnidf(t *testing.T) {
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
ignoreLogs = ['warning-b', 'WarniNg-C']
-- layouts/index.html --
-- layouts/home.html --
{{ warnidf "warning-a" "%s" "a"}}
{{ warnidf "warning-b" "%s" "b"}}
{{ warnidf "warNing-C" "%s" "c"}}

View File

@@ -33,7 +33,7 @@ theme = ["mytheme"]
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- themes/mytheme/static/images/pixel2.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{ $path := "static/images/pixel1.png" }}
fileExists OK: {{ fileExists $path }}|
imageConfig OK: {{ (imageConfig $path).Width }}|
@@ -59,7 +59,7 @@ func TestQR(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{- $text := "https://gohugo.io" }}
{{- $optionMaps := slice
(dict)
@@ -117,7 +117,7 @@ func TestImagesGoldenFuncs(t *testing.T) {
-- assets/sunset.jpg --
sourcefilename: ../../resources/testdata/sunset.jpg
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ template "copy" (dict "name" "qr-default.png" "img" (images.QR "https://gohugo.io")) }}

View File

@@ -30,7 +30,7 @@ theme = "mytheme"
Hello project!
-- themes/mytheme/mytheme.txt --
Hello theme!
-- layouts/index.html --
-- layouts/home.html --
{{ $entries := (readDir ".") }}
START:|{{ range $entry := $entries }}{{ if not $entry.IsDir }}{{ $entry.Name }}|{{ end }}{{ end }}:END:
@@ -56,7 +56,7 @@ func TestReadFileNotExists(t *testing.T) {
files := `
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{ $fi := (readFile "doesnotexist") }}
{{ if $fi }}Failed{{ else }}OK{{ end }}

View File

@@ -65,29 +65,29 @@ title: "P2_1"
---
{{< foo.inline >}}{{ if page.IsHome }}Shortcode in bundled page OK.{{ else}}Failed.{{ end }}{{< /foo.inline >}}
-- content/p3.md --
-- layouts/_default/_markup/render-heading.html --
-- layouts/_markup/render-heading.html --
{{ if page.IsHome }}
Heading OK.
{{ end }}
-- layouts/_default/_markup/render-image.html --
-- layouts/_markup/render-image.html --
{{ if page.IsHome }}
Image OK.
{{ end }}
-- layouts/_default/_markup/render-link.html --
-- layouts/_markup/render-link.html --
{{ if page.IsHome }}
Link OK.
{{ end }}
-- layouts/_default/myview.html
-- layouts/myview.html
{{ if page.IsHome }}
Render OK.
{{ end }}
-- layouts/_default/_markup/render-codeblock.html --
-- layouts/_markup/render-codeblock.html --
{{ if page.IsHome }}
Codeblock OK.
{{ end }}
-- layouts/_default/single.html --
-- layouts/single.html --
Single.
-- layouts/index.html --
-- layouts/home.html --
{{ if eq page . }}Page OK.{{ end }}
{{ $r := "{{ if page.IsHome }}ExecuteAsTemplate OK.{{ end }}" | resources.FromString "foo.html" | resources.ExecuteAsTemplate "foo.html" . }}
{{ $r.Content }}
@@ -104,13 +104,13 @@ Bundled page: {{ $p2_1.Content }}
{{ if eq page .Page }}Alias OK.{{ else }}Failed.{{ end }}
-- layouts/404.html --
{{ if eq page . }}404 Page OK.{{ else }}Failed.{{ end }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ if page.IsHome }}Partial OK.{{ else }}Failed.{{ end }}
-- layouts/shortcodes/outer.html --
-- layouts/_shortcodes/outer.html --
{{ .Inner }}
-- layouts/shortcodes/inner.html --
-- layouts/_shortcodes/inner.html --
{{ if page.IsHome }}Shortcode Inner OK.{{ else }}Failed.{{ end }}
-- layouts/shortcodes/shortcode.html --
-- layouts/_shortcodes/shortcode.html --
{{ if page.IsHome }}Shortcode {{ .Get 0 }} OK.{{ else }}Failed.{{ end }}
-- layouts/sitemap.xml --
{{ if eq page . }}Sitemap OK.{{ else }}Failed.{{ end }}
@@ -194,9 +194,9 @@ title: "P1"
{{< toc >}}
# Heading 1
-- layouts/shortcodes/toc.html --
-- layouts/_shortcodes/toc.html --
{{ page.TableOfContents }}
-- layouts/_default/single.html --
-- layouts/single.html --
{{ .Content }}
`
@@ -211,7 +211,7 @@ func TestFromStringRunning(t *testing.T) {
files := `
-- hugo.toml --
disableLiveReload = true
-- layouts/index.html --
-- layouts/home.html --
{{ with resources.FromString "foo" "{{ seq 3 }}" }}
{{ with resources.ExecuteAsTemplate "bar" $ . }}
{{ .Content | safeHTML }}

View File

@@ -33,9 +33,9 @@ func TestInclude(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
partial: {{ partials.Include "foo.html" . }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
foo
`
@@ -52,10 +52,10 @@ func TestIncludeCached(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
partialCached: {{ partials.IncludeCached "foo.html" . }}
partialCached: {{ partials.IncludeCached "foo.html" . }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
foo
`
@@ -74,11 +74,11 @@ func TestIncludeCachedRecursion(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
{{ partials.IncludeCached "p1.html" . }}
-- layouts/partials/p1.html --
-- layouts/_partials/p1.html --
{{ partials.IncludeCached "p2.html" . }}
-- layouts/partials/p2.html --
-- layouts/_partials/p2.html --
P2
`
@@ -102,13 +102,13 @@ baseURL = 'http://example.com/'
title: "Index"
---
{{< short >}}
-- layouts/index.html --
-- layouts/home.html --
{{ partials.IncludeCached "p1.html" . }}
-- layouts/partials/p1.html --
-- layouts/_partials/p1.html --
{{ .Content }}
{{ partials.IncludeCached "p2.html" . }}
-- layouts/partials/p2.html --
-- layouts/shortcodes/short.html --
-- layouts/_partials/p2.html --
-- layouts/_shortcodes/short.html --
SHORT
{{ partials.IncludeCached "p2.html" . }}
P2
@@ -134,7 +134,7 @@ templateMetricsHints=true
disableKinds = ["page", "section", "taxonomy", "term", "sitemap"]
[outputs]
home = ["HTML"]
-- layouts/index.html --
-- layouts/home.html --
{{ partials.IncludeCached "static1.html" . }}
{{ partials.IncludeCached "static1.html" . }}
{{ partials.Include "static2.html" . }}
@@ -147,13 +147,13 @@ H1I: {{ partials.Include "halfdynamic1.html" . }}
H1C: {{ partials.IncludeCached "halfdynamic1.html" . }}
H1C: {{ partials.IncludeCached "halfdynamic1.html" . }}
-- layouts/partials/static1.html --
-- layouts/_partials/static1.html --
P1
-- layouts/partials/static2.html --
-- layouts/_partials/static2.html --
P2
-- layouts/partials/dynamic1.html --
-- layouts/_partials/dynamic1.html --
{{ math.Counter }}
-- layouts/partials/halfdynamic1.html --
-- layouts/_partials/halfdynamic1.html --
D1
{{ math.Counter }}
@@ -192,7 +192,7 @@ D1
got = normalize(got)
expect := `
0 0 0 1 index.html
0 0 0 1 home.html
100 0 0 1 _partials/static2.html
100 50 1 2 _partials/static1.html
25 50 2 4 _partials/dynamic1.html
@@ -207,17 +207,17 @@ func BenchmarkIncludeCached(b *testing.B) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/_default/single.html --
-- layouts/home.html --
-- layouts/single.html --
{{ partialCached "heavy.html" "foo" }}
{{ partialCached "easy1.html" "bar" }}
{{ partialCached "easy1.html" "baz" }}
{{ partialCached "easy2.html" "baz" }}
-- layouts/partials/easy1.html --
-- layouts/_partials/easy1.html --
ABCD
-- layouts/partials/easy2.html --
-- layouts/_partials/easy2.html --
ABCDE
-- layouts/partials/heavy.html --
-- layouts/_partials/heavy.html --
{{ $result := slice }}
{{ range site.RegularPages }}
{{ $result = $result | append (dict "title" .Title "link" .RelPermalink "readingTime" .ReadingTime) }}
@@ -252,9 +252,9 @@ func TestIncludeTimeout(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
{{ partials.Include "foo.html" . }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ partial "foo.html" . }}
`
@@ -276,11 +276,11 @@ func TestIncludeCachedTimeout(t *testing.T) {
-- config.toml --
baseURL = 'http://example.com/'
timeout = '200ms'
-- layouts/index.html --
-- layouts/home.html --
{{ partials.IncludeCached "foo.html" . }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ partialCached "bar.html" . }}
-- layouts/partials/bar.html --
-- layouts/_partials/bar.html --
{{ partialCached "foo.html" . }}
`
@@ -303,15 +303,15 @@ func TestIncludeCachedDifferentKey(t *testing.T) {
-- config.toml --
baseURL = 'http://example.com/'
timeout = '200ms'
-- layouts/index.html --
-- layouts/home.html --
{{ partialCached "foo.html" "a" "a" }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ if eq . "a" }}
{{ partialCached "bar.html" . }}
{{ else }}
DONE
{{ end }}
-- layouts/partials/bar.html --
-- layouts/_partials/bar.html --
{{ partialCached "foo.html" "b" "b" }}
`
b := hugolib.Test(t, files)
@@ -328,13 +328,13 @@ func TestReturnExecuteFromTemplateInPartial(t *testing.T) {
files := `
-- config.toml --
baseURL = 'http://example.com/'
-- layouts/index.html --
-- layouts/home.html --
{{ $r := partial "foo" }}
FOO:{{ $r.Content }}
-- layouts/partials/foo.html --
-- layouts/_partials/foo.html --
{{ $r := §§{{ partial "bar" }}§§ | resources.FromString "bar.html" | resources.ExecuteAsTemplate "bar.html" . }}
{{ return $r }}
-- layouts/partials/bar.html --
-- layouts/_partials/bar.html --
BAR
`

View File

@@ -30,7 +30,7 @@ func TestCopy(t *testing.T) {
baseURL = "http://example.com/blog"
-- assets/images/pixel.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{/* Image resources */}}
{{ $img := resources.Get "images/pixel.png" }}
{{ $imgCopy1 := $img | resources.Copy "images/copy.png" }}
@@ -80,7 +80,7 @@ func TestCopyPageShouldFail(t *testing.T) {
files := `
-- config.toml --
-- layouts/index.html --
-- layouts/home.html --
{{/* This is currently not supported. */}}
{{ $copy := .Copy "copy.md" }}
@@ -103,7 +103,7 @@ func TestGet(t *testing.T) {
baseURL = "http://example.com/blog"
-- assets/images/pixel.png --
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==
-- layouts/index.html --
-- layouts/home.html --
{{ with resources.Get "images/pixel.png" }}Image OK{{ else }}Image not found{{ end }}
{{ with resources.Get "" }}Failed{{ else }}Empty string not found{{ end }}
@@ -127,7 +127,7 @@ func TestResourcesGettersShouldNotNormalizePermalinks(t *testing.T) {
baseURL = "http://example.com/"
-- assets/401K Prospectus.txt --
Prospectus.
-- layouts/index.html --
-- layouts/home.html --
{{ $name := "401K Prospectus.txt" }}
Get: {{ with resources.Get $name }}{{ .RelPermalink }}|{{ .Permalink }}|{{ end }}
GetMatch: {{ with resources.GetMatch $name }}{{ .RelPermalink }}|{{ .Permalink }}|{{ end }}
@@ -156,7 +156,7 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term']
I am a.txt
-- assets/b.txt --
I am b.txt
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ with resources.ByType "text" }}
{{ with .Get "a.txt" }}
@@ -188,7 +188,7 @@ I am b.txt
I am c.txt
-- assets/files/C.txt --
I am C.txt
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ with resources.ByType "text" }}
{{ with .Get "files/a.txt" }}
@@ -252,7 +252,7 @@ func TestDartSassVars(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ['page','section','rss','sitemap','taxonomy','term']
-- layouts/index.html --
-- layouts/home.html --
{{ $opts := dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" (dict "color" "red") }}
{{ with resources.Get "dartsass.scss" | css.Sass $opts }}
{{ .Content }}

View File

@@ -53,7 +53,7 @@ outputs: ["html", "amp"]
Hello.
-- layouts/baseof.html --
HTML|{{ block "main" . }}{{ end }}$
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
EDIT_COUNTER_OUTSIDE_0
{{ .Store.Set "hello" "Hello" }}
@@ -76,7 +76,7 @@ func TestDeferNoBaseof(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ with (templates.Defer (dict "key" "foo")) }}
Defer
@@ -103,7 +103,7 @@ func TestDeferBaseof(t *testing.T) {
Defer
{{ end }}
Block:{{ block "main" . }}{{ end }}$
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
Home.
{{ end }}
@@ -127,7 +127,7 @@ func TestDeferMain(t *testing.T) {
-- layouts/baseof.html --
Block:{{ block "main" . }}{{ end }}$
-- layouts/index.html --
-- layouts/home.html --
{{ define "main" }}
Home.
{{ with (templates.Defer (dict "key" "foo")) }}
@@ -165,7 +165,7 @@ func TestDeferRepeatedBuildsEditOutside(t *testing.T) {
for i := range 5 {
old := fmt.Sprintf("EDIT_COUNTER_OUTSIDE_%d", i)
new := fmt.Sprintf("EDIT_COUNTER_OUTSIDE_%d", i+1)
b.EditFileReplaceAll("layouts/index.html", old, new).Build()
b.EditFileReplaceAll("layouts/home.html", old, new).Build()
b.AssertFileContent("public/index.html", new)
}
}
@@ -178,7 +178,7 @@ func TestDeferRepeatedBuildsEditDefer(t *testing.T) {
for i := range 8 {
old := fmt.Sprintf("EDIT_COUNTER_DEFER_%d", i)
new := fmt.Sprintf("EDIT_COUNTER_DEFER_%d", i+1)
b.EditFileReplaceAll("layouts/index.html", old, new).Build()
b.EditFileReplaceAll("layouts/home.html", old, new).Build()
b.AssertFileContent("public/index.html", new)
}
}
@@ -207,7 +207,7 @@ func TestDeferEditDeferBlock(t *testing.T) {
b := hugolib.TestRunning(t, deferFilesCommon)
b.AssertRenderCountPage(4)
b.EditFileReplaceAll("layouts/index.html", "REPLACE_ME", "Edited.").Build()
b.EditFileReplaceAll("layouts/home.html", "REPLACE_ME", "Edited.").Build()
b.AssertFileContent("public/index.html", "Edited.")
b.AssertRenderCountPage(2)
}
@@ -240,7 +240,7 @@ target = "layouts"
source = 'public'
target = 'assets/public'
disableWatch = true
-- layouts/index.html --
-- layouts/home.html --
Home.
{{ $mydata := dict "v1" "v1value" }}
{{ $json := resources.FromString "mydata/data.json" ($mydata | jsonify ) }}
@@ -283,7 +283,7 @@ func TestDeferPostProcessShouldThrowAnError(t *testing.T) {
-- hugo.toml --
-- assets/mytext.txt --
ABCD.
-- layouts/index.html --
-- layouts/home.html --
Home
{{ with (templates.Defer (dict "key" "foo")) }}
{{ $mytext := resources.Get "mytext.txt" | minify | resources.PostProcess }}
@@ -302,7 +302,7 @@ func TestDeferMultipleInSameTemplate(t *testing.T) {
files := `
-- hugo.toml --
-- layouts/index.html --
-- layouts/home.html --
Home.
...
{{ with (templates.Defer (dict "data" (dict "a" "b") )) }}

Some files were not shown because too many files have changed in this diff Show More