mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
hugolib: Allow relative URLs in front matter
Before this commit you would have to do this in multilingual setups: ``` --- title: "Custom!" url: "/jp/custom/foo" --- ``` This commit allows for relative URLs, e.g: ``` --- title: "Custom!" url: "custom/foo" --- ``` Which is obviously easier and more portable. The meaning of relative may change to include more in the future (e.g. role based access). Fixes #5704
This commit is contained in:
@@ -124,6 +124,11 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
|
||||
|
||||
}
|
||||
|
||||
if d.URL != "" && !strings.HasPrefix(d.URL, "/") {
|
||||
// Treat this as a context relative URL
|
||||
d.ForcePrefix = true
|
||||
}
|
||||
|
||||
pagePath := slash
|
||||
|
||||
var (
|
||||
|
Reference in New Issue
Block a user