summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/404_test.go21
-rw-r--r--hugolib/alias.go2
-rw-r--r--hugolib/alias_test.go3
-rw-r--r--hugolib/breaking_changes_test.go2
-rw-r--r--hugolib/cascade_test.go111
-rw-r--r--hugolib/collections_test.go6
-rw-r--r--hugolib/config_test.go59
-rw-r--r--hugolib/configdir_test.go4
-rw-r--r--hugolib/content_factory.go27
-rw-r--r--hugolib/content_factory_test.go7
-rw-r--r--hugolib/content_map.go1107
-rw-r--r--hugolib/content_map_page.go2323
-rw-r--r--hugolib/content_map_test.go448
-rw-r--r--hugolib/content_render_hooks_test.go369
-rw-r--r--hugolib/dates_test.go10
-rw-r--r--hugolib/disableKinds_test.go22
-rw-r--r--hugolib/doctree/dimensions.go43
-rw-r--r--hugolib/doctree/dimensions_test.go37
-rw-r--r--hugolib/doctree/nodeshiftree_test.go374
-rw-r--r--hugolib/doctree/nodeshifttree.go433
-rw-r--r--hugolib/doctree/simpletree.go91
-rw-r--r--hugolib/doctree/support.go251
-rw-r--r--hugolib/doctree/treeshifttree.go101
-rw-r--r--hugolib/doctree/treeshifttree_test.go28
-rw-r--r--hugolib/fileInfo.go66
-rw-r--r--hugolib/filesystems/basefs.go441
-rw-r--r--hugolib/filesystems/basefs_test.go319
-rw-r--r--hugolib/frontmatter_test.go3
-rw-r--r--hugolib/hugo_modules_test.go394
-rw-r--r--hugolib/hugo_sites.go560
-rw-r--r--hugolib/hugo_sites_build.go613
-rw-r--r--hugolib/hugo_sites_build_errors_test.go38
-rw-r--r--hugolib/hugo_sites_build_test.go1093
-rw-r--r--hugolib/hugo_sites_multihost_test.go251
-rw-r--r--hugolib/hugo_sites_rebuild_test.go316
-rw-r--r--hugolib/hugo_sites_test.go58
-rw-r--r--hugolib/hugo_smoke_test.go527
-rw-r--r--hugolib/image_test.go9
-rw-r--r--hugolib/integration_test.go4
-rw-r--r--hugolib/integrationtest_builder.go189
-rw-r--r--hugolib/language_content_dir_test.go518
-rw-r--r--hugolib/menu_test.go92
-rw-r--r--hugolib/mount_filters_test.go7
-rw-r--r--hugolib/page.go796
-rw-r--r--hugolib/page__common.go53
-rw-r--r--hugolib/page__content.go700
-rw-r--r--hugolib/page__data.go24
-rw-r--r--hugolib/page__fragments_test.go4
-rw-r--r--hugolib/page__meta.go520
-rw-r--r--hugolib/page__new.go308
-rw-r--r--hugolib/page__output.go55
-rw-r--r--hugolib/page__paginator.go3
-rw-r--r--hugolib/page__paths.go74
-rw-r--r--hugolib/page__per_output.go627
-rw-r--r--hugolib/page__tree.go212
-rw-r--r--hugolib/page_test.go425
-rw-r--r--hugolib/page_unwrap.go3
-rw-r--r--hugolib/pagebundler_test.go1125
-rw-r--r--hugolib/pagecollections.go353
-rw-r--r--hugolib/pagecollections_test.go213
-rw-r--r--hugolib/pages_capture.go673
-rw-r--r--hugolib/pages_capture_test.go78
-rw-r--r--hugolib/pages_language_merge_test.go4
-rw-r--r--hugolib/pages_process.go203
-rw-r--r--hugolib/paths/paths.go3
-rw-r--r--hugolib/rebuild_test.go1256
-rw-r--r--hugolib/rendershortcodes_test.go32
-rw-r--r--hugolib/renderstring_test.go7
-rw-r--r--hugolib/resource_chain_test.go45
-rw-r--r--hugolib/rss_test.go2
-rw-r--r--hugolib/securitypolicies_test.go5
-rw-r--r--hugolib/shortcode.go58
-rw-r--r--hugolib/shortcode_page.go15
-rw-r--r--hugolib/shortcode_test.go12
-rw-r--r--hugolib/site.go736
-rw-r--r--hugolib/site_benchmark_new_test.go13
-rw-r--r--hugolib/site_new.go206
-rw-r--r--hugolib/site_output.go2
-rw-r--r--hugolib/site_output_test.go6
-rw-r--r--hugolib/site_render.go282
-rw-r--r--hugolib/site_sections_test.go111
-rw-r--r--hugolib/site_stats_test.go35
-rw-r--r--hugolib/site_test.go13
-rw-r--r--hugolib/site_url_test.go20
-rw-r--r--hugolib/sitemap_test.go168
-rw-r--r--hugolib/taxonomy_test.go114
-rw-r--r--hugolib/template_test.go62
-rw-r--r--hugolib/testhelpers_test.go128
-rw-r--r--hugolib/translations.go57
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|