Skip to content

Commit

Permalink
resources/page: Fix permalinks pattern detection for some of the sect…
Browse files Browse the repository at this point in the history
…ions variants

See #8363
  • Loading branch information
bep committed Apr 25, 2021
1 parent 048418b commit c13d368
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions resources/page/permalinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ 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) {
return path.Join(fn(p.CurrentSection().SectionsEntries())...), nil
}, true
}

// Make sure this comes after all the other checks.
if referenceTime.Format(attr) != attr {
return p.pageToPermalinkDate, true
}

return nil, false
}

Expand Down

0 comments on commit c13d368

Please sign in to comment.