diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-03-30 17:08:25 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-04-02 10:32:47 +0200 |
commit | 92baa14fd3f45c0917c5988235cd1a0f8692f171 (patch) | |
tree | 130417443701331257f57f3d198eba2a037c079d /hugolib/page__meta.go | |
parent | a55640de8e3944d3b9f64b15155148a0e35cb31e (diff) | |
download | hugo-92baa14fd3f45c0917c5988235cd1a0f8692f171.tar.gz hugo-92baa14fd3f45c0917c5988235cd1a0f8692f171.zip |
hugolib: Allow page-relative aliases
Fixes #5757
Diffstat (limited to 'hugolib/page__meta.go')
-rw-r--r-- | hugolib/page__meta.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go index 9f5f369b3..1e013db66 100644 --- a/hugolib/page__meta.go +++ b/hugolib/page__meta.go @@ -16,6 +16,7 @@ package hugolib import ( "fmt" "path" + "path/filepath" "regexp" "strings" "time" @@ -414,10 +415,11 @@ func (pm *pageMeta) setMetadata(p *pageState, frontmatter map[string]interface{} pm.params[loki] = pm.weight case "aliases": pm.aliases = cast.ToStringSlice(v) - for _, alias := range pm.aliases { + for i, alias := range pm.aliases { if strings.HasPrefix(alias, "http://") || strings.HasPrefix(alias, "https://") { - return fmt.Errorf("only relative aliases are supported, %v provided", alias) + return fmt.Errorf("http* aliases not supported: %q", alias) } + pm.aliases[i] = filepath.ToSlash(alias) } pm.params[loki] = pm.aliases case "sitemap": |