hugolib: Correctly identify "my_index_page.md"

The above example was earlier identified as a section page and not a regular page.

Fixes #3234
This commit is contained in:
Bjørn Erik Pedersen
2017-03-25 09:56:00 +01:00
parent 7f68e3199e
commit 17b21e0af1
2 changed files with 22 additions and 1 deletions

View File

@@ -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
}