]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Replace deprecated :filename with :contentbasename in the permalinks test
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 17 Mar 2026 15:17:47 +0000 (16:17 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 18 Mar 2026 07:47:26 +0000 (08:47 +0100)
check.sh
common/hugo/hugo.go
hugolib/hugo_modules_test.go
hugolib/hugo_sites_multihost_test.go
hugolib/page_test.go
hugolib/pagebundler_test.go
resources/page/permalinks_integration_test.go

index fc7c6849accb3eae1a9326fa18185780c6fc29c3..20aacb1eff126208af4502d241f1628ea28dd60d 100755 (executable)
--- a/check.sh
+++ b/check.sh
@@ -52,7 +52,7 @@ run_staticcheck() {
 run_tests() {
     echo "==> Running tests..."
     local output
-    if ! output=$(go test $PACKAGES 2>&1); then
+    if ! output=$(go test -failfast $PACKAGES 2>&1); then
         echo "$output"
         exit 1
     fi
index 0ac89cbb10b9736dd912d7a8b669d44e1c3178fa..6793216028073bc0cbcc8cdd9cd7daccbccd910d 100644 (file)
@@ -336,6 +336,8 @@ func deprecateLevel(item, alternative, version string, level logg.Level) {
 func deprecateLevelWithLogger(item, alternative, version string, level logg.Level, log logg.Logger) {
        var msg string
        if level == logg.LevelError {
+               // Useful to debug deprecation errors that needs to be removedor fixed. Comment out when done debugging.
+               // hdebug.Panicf("deprecation error: %s was removed in Hugo %s. %s", item, version, alternative)
                msg = fmt.Sprintf("%s was deprecated in Hugo %s and subsequently removed. %s", item, version, alternative)
        } else {
                msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
index 450e4cbce88bd41daf232aa47a612f056cbd7b48..f2f365e50b31dd99699d10dd29349ed72189042f 100644 (file)
@@ -86,7 +86,7 @@ title = "French Title"
 {{ range .Site.RegularPages }}
 |{{ .Title }}|{{ .RelPermalink }}|{{ .Plain }}
 {{ end }}
-{{ $data := .Site.Data }}
+{{ $data := hugo.Data }}
 Data Common: {{ $data.common.value }}
 Data C: {{ $data.c.value }}
 Data D: {{ $data.d.value }}
index 875fcfd5a002c19dff74c281ab5705c3eaa752d1..a3b3a9ff91247aa31e3566feb5fb40f2e540e3ce 100644 (file)
@@ -20,7 +20,7 @@ enableRobotsTXT = true
 pagerSize = 1
 
 [permalinks]
-other = "/somewhere/else/:filename"
+other = "/somewhere/else/:contentbasename"
 
 [taxonomies]
 tag = "tags"
index 0d9c99505282fac495b984da84506e52b66ea4de..245456b97c3abb820e25d814f4d0824f9845d546 100644 (file)
@@ -1691,7 +1691,7 @@ func TestPagePathDisablePathToLower(t *testing.T) {
 baseURL = "http://example.com"
 disablePathToLower = true
 [permalinks]
-sect2 = "/:section/:filename/"
+sect2 = "/:section/:contentbasename/"
 sect3 = "/:section/:title/"
 -- content/sect/p1.md --
 ---
index 7ec749877ccae8c4945078b43a0558bcc89c412c..0ea695366f325a50ee37939d2d24a3a92a8937fe 100644 (file)
@@ -635,7 +635,7 @@ func TestHTMLFilesIsue11999(t *testing.T) {
 -- hugo.toml --
 disableKinds = ["taxonomy", "term", "rss", "sitemap", "robotsTXT", "404"]
 [permalinks]
-posts = "/myposts/:slugorfilename"
+posts = "/myposts/:slugorcontentbasename"
 -- content/posts/markdown-without-frontmatter.md --
 -- content/posts/html-without-frontmatter.html --
 <html>hello</html>
index b33c599a7c75640e50215fc09406179e0d30c947..9406d133c568b783ed6d4723051b470b363b7e07 100644 (file)
@@ -41,11 +41,11 @@ withallbutlastsectionslug = '/:sectionslugs[:last]/:slug/'
 withsectionslug = '/sectionslug/:sectionslug/:slug/'
 withsectionslugs = '/sectionslugs/:sectionslugs/:slug/'
 [permalinks.section]
-withfilefilename = '/sectionwithfilefilename/:filename/'
+withfilefilename = '/sectionwithfilefilename/:contentbasename/'
 withfilefiletitle = '/sectionwithfilefiletitle/:title/'
 withfileslug = '/sectionwithfileslug/:slug/'
 nofileslug = '/sectionnofileslug/:slug/'
-nofilefilename = '/sectionnofilefilename/:filename/'
+nofilefilename = '/sectionnofilefilename/:contentbasename/'
 nofiletitle1 = '/sectionnofiletitle1/:title/'
 nofiletitle2 = '/sectionnofiletitle2/:sections[:last]/'
 [permalinks.term]
@@ -125,9 +125,12 @@ slug: "mytagslug"
        b.AssertFileContent("public/pageslug/p1slugvalue/index.html", "Single|page|/pageslug/p1slugvalue/|")
        b.AssertFileContent("public/sectionslug/section-root-slug/page1-slug/index.html", "Single|page|/sectionslug/section-root-slug/page1-slug/|")
        b.AssertFileContent("public/sectionslugs/sections-root-slug/level1-slug/page1-slug/index.html", "Single|page|/sectionslugs/sections-root-slug/level1-slug/page1-slug/|")
-       b.AssertFileContent("public/sectionwithfilefilename/index.html", "List|section|/sectionwithfilefilename/|")
+
+       b.AssertFileContent("public/sectionwithfilefilename/withfilefilename/index.html", "List|section|/sectionwithfilefilename/withfilefilename/|")
+
        b.AssertFileContent("public/sectionwithfileslug/withfileslugvalue/index.html", "List|section|/sectionwithfileslug/withfileslugvalue/|")
-       b.AssertFileContent("public/sectionnofilefilename/index.html", "List|section|/sectionnofilefilename/|")
+
+       b.AssertFileContent("public/sectionnofilefilename/nofilefilename/index.html", "List|section|/sectionnofilefilename/nofilefilename/|")
        b.AssertFileContent("public/sectionnofileslug/nofileslugs/index.html", "List|section|/sectionnofileslug/nofileslugs/|")
        b.AssertFileContent("public/sectionnofiletitle1/nofiletitle1s/index.html", "List|section|/sectionnofiletitle1/nofiletitle1s/|")
        b.AssertFileContent("public/sectionnofiletitle2/index.html", "List|section|/sectionnofiletitle2/|")
@@ -138,7 +141,7 @@ slug: "mytagslug"
        permalinksConf := b.H.Configs.Base.Permalinks
        b.Assert(permalinksConf, qt.DeepEquals, map[string]map[string]string{
                "page":     {"withallbutlastsection": "/:sections[:last]/:slug/", "withallbutlastsectionslug": "/:sectionslugs[:last]/:slug/", "withpageslug": "/pageslug/:slug/", "withsectionslug": "/sectionslug/:sectionslug/:slug/", "withsectionslugs": "/sectionslugs/:sectionslugs/:slug/"},
-               "section":  {"nofilefilename": "/sectionnofilefilename/:filename/", "nofileslug": "/sectionnofileslug/:slug/", "nofiletitle1": "/sectionnofiletitle1/:title/", "nofiletitle2": "/sectionnofiletitle2/:sections[:last]/", "withfilefilename": "/sectionwithfilefilename/:filename/", "withfilefiletitle": "/sectionwithfilefiletitle/:title/", "withfileslug": "/sectionwithfileslug/:slug/"},
+               "section":  {"nofilefilename": "/sectionnofilefilename/:contentbasename/", "nofileslug": "/sectionnofileslug/:slug/", "nofiletitle1": "/sectionnofiletitle1/:title/", "nofiletitle2": "/sectionnofiletitle2/:sections[:last]/", "withfilefilename": "/sectionwithfilefilename/:contentbasename/", "withfilefiletitle": "/sectionwithfilefiletitle/:title/", "withfileslug": "/sectionwithfileslug/:slug/"},
                "taxonomy": {"tags": "/tagsslug/:slug/"},
                "term":     {"tags": "/tagsslug/tag/:slug/"},
        })
@@ -192,7 +195,7 @@ func TestPermalinksNestedSections(t *testing.T) {
        files := `
 -- hugo.toml --
 [permalinks.page]
-books = '/libros/:sections[1:]/:filename'
+books = '/libros/:sections[1:]/:contentbasename'
 
 [permalinks.section]
 books = '/libros/:sections[1:]'