From f98e570b17d99e0ca7a6e6792a4c741cfc8b81e8 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 1 Mar 2022 20:27:52 -0800 Subject: [PATCH] Add lang attribute to internal alias template Closes #9586 --- hugolib/alias_test.go | 4 ++-- hugolib/hugo_sites_build_test.go | 4 ++-- hugolib/page_test.go | 4 ++-- tpl/tplimpl/embedded/templates/alias.html | 11 ++++++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/hugolib/alias_test.go b/hugolib/alias_test.go index d5ffc06fe..8c00f8360 100644 --- a/hugolib/alias_test.go +++ b/hugolib/alias_test.go @@ -71,8 +71,8 @@ func TestAlias(t *testing.T) { // the real page b.AssertFileContent("public/blog/page"+test.fileSuffix, "For some moments the old man") // the alias redirectors - b.AssertFileContent("public/foo/bar"+test.fileSuffix, "") - b.AssertFileContent("public/blog/rel"+test.fileSuffix, "") + b.AssertFileContent("public/foo/bar"+test.fileSuffix, "") + b.AssertFileContent("public/blog/rel"+test.fileSuffix, "") } } diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index fdfc33c5a..35804b89a 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -83,14 +83,14 @@ func doTestMultiSitesMainLangInRoot(t *testing.T, defaultInSubDir bool) { c.Assert(frRelPerm, qt.Equals, "/blog/fr/sect/doc1/") // should have a redirect on top level. - b.AssertFileContent("public/index.html", ``) + b.AssertFileContent("public/index.html", ``) } else { // Main language in root c.Assert(frPerm, qt.Equals, "http://example.com/blog/sect/doc1/") c.Assert(frRelPerm, qt.Equals, "/blog/sect/doc1/") // should have redirect back to root - b.AssertFileContent("public/fr/index.html", ``) + b.AssertFileContent("public/fr/index.html", ``) } b.AssertFileContent(pathMod("public/fr/index.html"), "Home", "Bonjour") b.AssertFileContent("public/en/index.html", "Home", "Hello") diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 637ac46f7..926fdb354 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -1653,11 +1653,11 @@ tags: th.assertFileContent(pathFunc("public/post/test0.dot/index.html"), "some content") if uglyURLs { - th.assertFileContent("public/post/page/1.html", `canonical" href="/post.html"/`) + th.assertFileContent("public/post/page/1.html", `canonical" href="/post.html"`) th.assertFileContent("public/post.html", `P1|URL: /post.html|Next: /post/page/2.html`) th.assertFileContent("public/post/page/2.html", `P2|URL: /post/page/2.html|Next: /post/page/3.html`) } else { - th.assertFileContent("public/post/page/1/index.html", `canonical" href="/post/"/`) + th.assertFileContent("public/post/page/1/index.html", `canonical" href="/post/"`) th.assertFileContent("public/post/index.html", `P1|URL: /post/|Next: /post/page/2/`) th.assertFileContent("public/post/page/2/index.html", `P2|URL: /post/page/2/|Next: /post/page/3/`) th.assertFileContent("public/tags/.net/index.html", `P1|URL: /tags/.net/|Next: /tags/.net/page/2/`) diff --git a/tpl/tplimpl/embedded/templates/alias.html b/tpl/tplimpl/embedded/templates/alias.html index ee3f556e5..8448760fa 100644 --- a/tpl/tplimpl/embedded/templates/alias.html +++ b/tpl/tplimpl/embedded/templates/alias.html @@ -1 +1,10 @@ -{{ .Permalink }} \ No newline at end of file + + + + {{ .Permalink }} + + + + + +