mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
resources: Preserve url set in frontmatter without sanitizing
related #6007 (already closed)
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
18c13adcd4
commit
e4fcb672ed
@@ -308,12 +308,16 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
|
||||
|
||||
linkDir = strings.TrimSuffix(path.Join(slash, linkDir), slash)
|
||||
|
||||
// Note: MakePathSanitized will lower case the path if
|
||||
// disablePathToLower isn't set.
|
||||
pagePath = d.PathSpec.MakePathSanitized(pagePath)
|
||||
pagePathDir = d.PathSpec.MakePathSanitized(pagePathDir)
|
||||
link = d.PathSpec.MakePathSanitized(link)
|
||||
linkDir = d.PathSpec.MakePathSanitized(linkDir)
|
||||
// if page URL is explicitly set in frontmatter,
|
||||
// preserve its value without sanitization
|
||||
if d.Kind != KindPage || d.URL == "" {
|
||||
// Note: MakePathSanitized will lower case the path if
|
||||
// disablePathToLower isn't set.
|
||||
pagePath = d.PathSpec.MakePathSanitized(pagePath)
|
||||
pagePathDir = d.PathSpec.MakePathSanitized(pagePathDir)
|
||||
link = d.PathSpec.MakePathSanitized(link)
|
||||
linkDir = d.PathSpec.MakePathSanitized(linkDir)
|
||||
}
|
||||
|
||||
tp.TargetFilename = filepath.FromSlash(pagePath)
|
||||
tp.SubResourceBaseTarget = filepath.FromSlash(pagePathDir)
|
||||
|
Reference in New Issue
Block a user