mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-09 01:30:57 +00:00
parent
50df31406f
commit
664a97819f
2 changed files with 8 additions and 6 deletions
|
@ -1314,7 +1314,9 @@ func (s *Site) RenderHomePage() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(bep) reusing the Home Node smells trouble
|
||||||
n.URL = helpers.URLize("404.html")
|
n.URL = helpers.URLize("404.html")
|
||||||
|
n.IsHome = false
|
||||||
n.Title = "404 Page not found"
|
n.Title = "404 Page not found"
|
||||||
n.Permalink = s.permalink("404.html")
|
n.Permalink = s.permalink("404.html")
|
||||||
|
|
||||||
|
|
|
@ -398,9 +398,9 @@ func doTest404ShouldAlwaysHaveUglyUrls(t *testing.T, uglyURLs bool) {
|
||||||
s.initializeSiteInfo()
|
s.initializeSiteInfo()
|
||||||
templatePrep(s)
|
templatePrep(s)
|
||||||
|
|
||||||
must(s.addTemplate("index.html", "Home Sweet Home"))
|
must(s.addTemplate("index.html", "Home Sweet Home. IsHome={{ .IsHome }}"))
|
||||||
must(s.addTemplate("_default/single.html", "{{.Content}}"))
|
must(s.addTemplate("_default/single.html", "{{.Content}} IsHome={{ .IsHome }}"))
|
||||||
must(s.addTemplate("404.html", "Page Not Found"))
|
must(s.addTemplate("404.html", "Page Not Found. IsHome={{ .IsHome }}"))
|
||||||
|
|
||||||
// make sure the XML files also end up with ugly urls
|
// make sure the XML files also end up with ugly urls
|
||||||
must(s.addTemplate("rss.xml", "<root>RSS</root>"))
|
must(s.addTemplate("rss.xml", "<root>RSS</root>"))
|
||||||
|
@ -421,9 +421,9 @@ func doTest404ShouldAlwaysHaveUglyUrls(t *testing.T, uglyURLs bool) {
|
||||||
doc string
|
doc string
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{filepath.FromSlash("index.html"), "Home Sweet Home"},
|
{filepath.FromSlash("index.html"), "Home Sweet Home. IsHome=true"},
|
||||||
{filepath.FromSlash(expectedPagePath), "\n\n<h1 id=\"title:5d74edbb89ef198cd37882b687940cda\">title</h1>\n\n<p>some <em>content</em></p>\n"},
|
{filepath.FromSlash(expectedPagePath), "\n\n<h1 id=\"title:5d74edbb89ef198cd37882b687940cda\">title</h1>\n\n<p>some <em>content</em></p>\n IsHome=false"},
|
||||||
{filepath.FromSlash("404.html"), "Page Not Found"},
|
{filepath.FromSlash("404.html"), "Page Not Found. IsHome=false"},
|
||||||
{filepath.FromSlash("index.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>RSS</root>"},
|
{filepath.FromSlash("index.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>RSS</root>"},
|
||||||
{filepath.FromSlash("sitemap.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>SITEMAP</root>"},
|
{filepath.FromSlash("sitemap.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>SITEMAP</root>"},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue