Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-05-14 22:37:53 +0300
committerbep <bjorn.erik.pedersen@gmail.com>2015-05-14 22:37:45 +0300
commitbe1a566203292bff51298afd4c8c46bd6df7cc0a (patch)
tree5c6bd0446ad8791ab882826a59c967526faad626 /target
parentbe1287fba05fb87e80aaf3c277dd7c74408375e2 (diff)
Only uglify 404.html on server root
`404.html` needs to be that and not `/404/` in the root. There seem to be content pages in the wild with the name `404` (Hugo docs), so this commit adds an extra check so only root 404 pages ignore the `uglifyURLs`setting. Fixes #1140
Diffstat (limited to 'target')
-rw-r--r--target/page.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/target/page.go b/target/page.go
index fb081fedb..57e3a300b 100644
--- a/target/page.go
+++ b/target/page.go
@@ -40,13 +40,14 @@ func (pp *PagePub) Translate(src string) (dest string, err error) {
}
dir, file := filepath.Split(src)
+ isRoot := dir == ""
ext := pp.extension(filepath.Ext(file))
name := filename(file)
if pp.PublishDir != "" {
dir = filepath.Join(pp.PublishDir, dir)
}
- if pp.UglyURLs || file == "index.html" || file == "404.html" {
+ if pp.UglyURLs || file == "index.html" || (isRoot && file == "404.html") {
return filepath.Join(dir, fmt.Sprintf("%s%s", name, ext)), nil
}