diff options
Diffstat (limited to 'hugolib')
89 files changed, 10207 insertions, 11011 deletions
diff --git a/hugolib/404_test.go b/hugolib/404_test.go index 383302e0b..3c6a06045 100644 --- a/hugolib/404_test.go +++ b/hugolib/404_test.go @@ -20,10 +20,10 @@ import ( func Test404(t *testing.T) { t.Parallel() - b := newTestSitesBuilder(t) - b.WithSimpleConfigFile().WithTemplatesAdded( - "404.html", - ` + files := ` +-- hugo.toml -- +baseURL = "http://example.com/" +-- layouts/404.html -- {{ $home := site.Home }} 404: Parent: {{ .Parent.Kind }} @@ -35,16 +35,21 @@ InSection: {{ .InSection $home.Section }}|{{ $home.InSection . }} Sections: {{ len .Sections }}| Page: {{ .Page.RelPermalink }}| Data: {{ len .Data }}| +` -`, - ) - b.Build(BuildCfg{}) + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + //LogLevel: logg.LevelTrace, + //Verbose: true, + }, + ).Build() // Note: We currently have only 1 404 page. One might think that we should have // multiple, to follow the Custom Output scheme, but I don't see how that would work // right now. b.AssertFileContent("public/404.html", ` - 404: Parent: home IsAncestor: false/true diff --git a/hugolib/alias.go b/hugolib/alias.go index 5165edb04..08d57a8bc 100644 --- a/hugolib/alias.go +++ b/hugolib/alias.go @@ -64,7 +64,7 @@ func (a aliasHandler) renderAlias(permalink string, p page.Page) (io.Reader, err p, } - ctx := tpl.SetPageInContext(context.Background(), p) + ctx := tpl.Context.Page.Set(context.Background(), p) buffer := new(bytes.Buffer) err := a.t.ExecuteWithContext(ctx, templ, buffer, data) diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go index e03107ada..c017050c6 100644 --- a/hugolib/alias_test.go +++ b/hugolib/alias_test.go @@ -14,6 +14,7 @@ package hugolib import ( + "os" "path/filepath" "runtime" "testing" @@ -90,6 +91,8 @@ func TestAliasMultipleOutputFormats(t *testing.T) { b.CreateSites().Build(BuildCfg{}) + b.H.Sites[0].pageMap.debugPrint("", 999, os.Stdout) + // the real pages b.AssertFileContent("public/blog/page/index.html", "For some moments the old man") b.AssertFileContent("public/amp/blog/page/index.html", "For some moments the old man") diff --git a/hugolib/breaking_changes_test.go b/hugolib/breaking_changes_test.go index 533205deb..fbbf27aed 100644 --- a/hugolib/breaking_changes_test.go +++ b/hugolib/breaking_changes_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Hugo Authors. All rights reserved. +// Copyright 2024 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go index 0f607ecb5..194faeb0a 100644 --- a/hugolib/cascade_test.go +++ b/hugolib/cascade_test.go @@ -126,7 +126,7 @@ cascade: b.Build(BuildCfg{}) - p1 := b.H.Sites[0].getPage("p1") + p1 := b.H.Sites[0].getPageOldVersion("p1") if withHomeContent { b.Assert(p1.Params(), qt.DeepEquals, maps.Params{ @@ -158,34 +158,38 @@ func TestCascade(t *testing.T) { b := newCascadeTestBuilder(t, langs) b.Build(BuildCfg{}) + // b.H.Sites[0].pageMap.debugPrint("", 999, os.Stdout) + + // 12|term|/categories/cool|Cascade Category|cat.png|page|html-|\ + b.AssertFileContent("public/index.html", ` -12|term|categories/cool/_index.md|Cascade Category|cat.png|categories|html-| -12|term|categories/catsect1|catsect1|cat.png|categories|html-| -12|term|categories/funny|funny|cat.png|categories|html-| -12|taxonomy|categories/_index.md|My Categories|cat.png|categories|html-| -32|term|categories/sad/_index.md|Cascade Category|sad.png|categories|html-| -42|term|tags/blue|blue|home.png|tags|html-| -42|taxonomy|tags|Cascade Home|home.png|tags|html-| -42|section|sectnocontent|Cascade Home|home.png|sectnocontent|html-| -42|section|sect3|Cascade Home|home.png|sect3|html-| -42|page|bundle1/index.md|Cascade Home|home.png|page|html-| -42|page|p2.md|Cascade Home|home.png|page|html-| -42|page|sect2/p2.md|Cascade Home|home.png|sect2|html-| -42|page|sect3/nofrontmatter.md|Cascade Home|home.png|sect3|html-| -42|page|sect3/p1.md|Cascade Home|home.png|sect3|html-| -42|page|sectnocontent/p1.md|Cascade Home|home.png|sectnocontent|html-| -42|section|sectnofrontmatter/_index.md|Cascade Home|home.png|sectnofrontmatter|html-| -42|term|tags/green|green|home.png|tags|html-| -42|home|_index.md|Home|home.png|page|html-| -42|page|p1.md|p1|home.png|page|html-| -42|section|sect1/_index.md|Sect1|sect1.png|stype|html-| -42|section|sect1/s1_2/_index.md|Sect1_2|sect1.png|stype|html-| -42|page|sect1/s1_2/p1.md|Sect1_2_p1|sect1.png|stype|html-| -42|page|sect1/s1_2/p2.md|Sect1_2_p2|sect1.png|stype|html-| -42|section|sect2/_index.md|Sect2|home.png|sect2|html-| -42|page|sect2/p1.md|Sect2_p1|home.png|sect2|html-| -52|page|sect4/p1.md|Cascade Home|home.png|sect4|rss-| -52|section|sect4/_index.md|Sect4|home.png|sect4|rss-| +12|term|/categories/cool|Cascade Category| |