Don't use the baseURL /path as part of the resource cache key

As that prevents Hugo projects with sub paths in their `baseURL` to use themes with cached resources.

Fixes #9787
This commit is contained in:
Bjørn Erik Pedersen
2022-05-27 13:23:37 +02:00
parent 46a2ea6d0d
commit dd9eaf19fd
3 changed files with 83 additions and 21 deletions

View File

@@ -20,6 +20,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"sync"
"github.com/gohugoio/hugo/resources/internal"
@@ -267,7 +268,10 @@ func (l *genericResource) Data() any {
}
func (l *genericResource) Key() string {
return l.RelPermalink()
if l.spec.BasePath == "" {
return l.RelPermalink()
}
return strings.TrimPrefix(l.RelPermalink(), l.spec.BasePath)
}
func (l *genericResource) MediaType() media.Type {