summaryrefslogtreecommitdiffstats
path: root/hugolib/page.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-25 09:56:00 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-25 19:57:01 +0100
commit17b21e0af1e716bdc7f80b0b2b19b5e469344b34 (patch)
treee2b574deb1a1d4a5fff1a3cbd82b71b7572ca43b /hugolib/page.go
parent7f68e3199ef3a62aef06251bd641435617257d48 (diff)
hugolib: Correctly identify "my_index_page.md"
The above example was earlier identified as a section page and not a regular page. Fixes #3234
Diffstat (limited to 'hugolib/page.go')
-rw-r--r--hugolib/page.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/page.go b/hugolib/page.go
index e23434a78..141a71420 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -1859,8 +1859,15 @@ func sectionsFromFilename(filename string) []string {
return sections
}
+const (
+ regularPageFileNameDoesNotStartWith = "_index"
+
+ // There can be "my_regular_index_page.md but not /_index_file.md
+ regularPageFileNameDoesNotContain = helpers.FilePathSeparator + regularPageFileNameDoesNotStartWith
+)
+
func kindFromFilename(filename string) string {
- if !strings.Contains(filename, "_index") {
+ if !strings.HasPrefix(filename, regularPageFileNameDoesNotStartWith) && !strings.Contains(filename, regularPageFileNameDoesNotContain) {
return KindPage
}