summaryrefslogtreecommitdiffstats
path: root/resources/page/page_paths.go
diff options
context:
space:
mode:
Diffstat (limited to 'resources/page/page_paths.go')
-rw-r--r--resources/page/page_paths.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/resources/page/page_paths.go b/resources/page/page_paths.go
index 6b2c8e8b1..354292e1a 100644
--- a/resources/page/page_paths.go
+++ b/resources/page/page_paths.go
@@ -140,11 +140,17 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
pb.isUgly = (d.UglyURLs || d.Type.Ugly) && !d.Type.NoUgly
pb.baseNameSameAsType = !d.Path.IsBundle() && d.BaseName != "" && d.BaseName == d.Type.BaseName
+ indexIsUglyKind := d.Kind == kinds.KindHome || d.Kind == kinds.KindSection || d.Kind == kinds.KindTaxonomy
+ indexIsUglyKind = indexIsUglyKind && pb.isUgly
if d.ExpandedPermalink == "" && pb.baseNameSameAsType {
pb.isUgly = true
}
+ if d.Type.Path != "" {
+ pb.Add(d.Type.Path)
+ }
+
if d.Type == output.HTTPStatus404HTMLFormat || d.Type == output.SitemapFormat || d.Type == output.RobotsTxtFormat {
pb.noSubResources = true
} else if d.Kind != kinds.KindPage && d.URL == "" && d.Section.Base() != "/" {
@@ -156,10 +162,6 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
needsBase = false
}
- if d.Type.Path != "" {
- pb.Add(d.Type.Path)
- }
-
if d.Kind != kinds.KindHome && d.URL != "" {
pb.Add(paths.FieldsSlash(d.URL)...)
@@ -233,13 +235,13 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
needsBase = needsBase && d.Addends == ""
- if needsBase || !pb.isUgly {
+ if needsBase || (!pb.isUgly || indexIsUglyKind) {
pb.Add(d.Type.BaseName + pb.fullSuffix)
} else {
pb.ConcatLast(pb.fullSuffix)
}
- if pb.IsHtmlIndex() {
+ if !indexIsUglyKind && pb.IsHtmlIndex() {
pb.linkUpperOffset = 1
}
@@ -261,6 +263,7 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
}
link := pb.Link()
+
pagePath := pb.PathFile()
tp.TargetFilename = filepath.FromSlash(pagePath)