diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-27 09:15:47 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-27 10:43:23 +0100 |
commit | 6bc0d745a5897b70a9356035f959ee0310e83fc9 (patch) | |
tree | 6ca5bb2020dddf176caeec3422e39539738039bb /resources | |
parent | 218690328cd2c379e3947cd7b330ca4353fae49b (diff) | |
download | hugo-6bc0d745a5897b70a9356035f959ee0310e83fc9.tar.gz hugo-6bc0d745a5897b70a9356035f959ee0310e83fc9.zip |
Fix multihost processed image not copied to non-default content languages
Fixes #12163
Diffstat (limited to 'resources')
-rw-r--r-- | resources/image_cache.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/resources/image_cache.go b/resources/image_cache.go index f9770ffc1..d824c5d1a 100644 --- a/resources/image_cache.go +++ b/resources/image_cache.go @@ -39,7 +39,16 @@ func (c *ImageCache) getOrCreate( ) (*resourceAdapter, error) { relTarget := parent.relTargetPathFromConfig(conf) relTargetPath := relTarget.TargetPath() - memKey := dynacache.CleanKey(relTargetPath) + memKey := relTargetPath + + // For multihost sites, we duplicate language versions of the same resource, + // so we need to include the language in the key. + // Note that we don't need to include the language in the file cache key, + // as the hash will take care of any different content. + if c.pathSpec.Cfg.IsMultihost() { + memKey = c.pathSpec.Lang() + memKey + } + memKey = dynacache.CleanKey(memKey) v, err := c.mcache.GetOrCreate(memKey, func(key string) (*resourceAdapter, error) { var img *imageResource |