Update 404 to be compiled to .html instead of directory
authorChase Adams <chase@realchaseadams.com>
Thu, 21 Aug 2014 02:57:51 +0000 (19:57 -0700)
committerspf13 <steve.francia@gmail.com>
Mon, 25 Aug 2014 13:38:08 +0000 (09:38 -0400)
hugolib/site.go

index 134b1898e93374958a1910df1ad0d32bb1d2b45d..aef7c38fbd0dfc2769d90da3c71d419897b6e957 100644 (file)
@@ -748,6 +748,15 @@ func (s *Site) RenderHomePage() error {
                }
        }
 
+       // Force `UglyUrls` option to force `404.html` file name
+       switch s.Target.(type) {
+       case *target.Filesystem:
+               if !s.Target.(*target.Filesystem).UglyUrls {
+                       s.Target.(*target.Filesystem).UglyUrls = true
+                       defer func() { s.Target.(*target.Filesystem).UglyUrls = false }()
+               }
+       }
+
        n.Url = helpers.Urlize("404.html")
        n.Title = "404 Page not found"
        n.Permalink = s.permalink("404.html")