resources/page: Fix permalinks pattern detection for some of the sections variants - hugo - [fork] hugo port for 9front
(HTM) git clone git@git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit c13d368746992eb39a33f065ca808e129baec4ef
(DIR) parent 048418ba749d02eb3dde9d6895cedef2adaefefd
(HTM) Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sun, 25 Apr 2021 16:57:09 +0200
resources/page: Fix permalinks pattern detection for some of the sections variants
See #8363
Diffstat:
M resources/page/permalinks.go | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/resources/page/permalinks.go b/resources/page/permalinks.go
@@ -51,10 +51,6 @@ func (p PermalinkExpander) callback(attr string) (pageToPermaAttribute, bool) {
return callback, true
}
- if referenceTime.Format(attr) != attr {
- return p.pageToPermalinkDate, true
- }
-
if strings.HasPrefix(attr, "sections[") {
fn := p.toSliceFunc(strings.TrimPrefix(attr, "sections"))
return func(p Page, s string) (string, error) {
@@ -62,6 +58,11 @@ func (p PermalinkExpander) callback(attr string) (pageToPermaAttribute, bool) {
}, true
}
+ // Make sure this comes after all the other checks.
+ if referenceTime.Format(attr) != attr {
+ return p.pageToPermalinkDate, true
+ }
+
return nil, false
}