diff options
Diffstat (limited to 'layouts/partials/utils/content.html')
-rw-r--r-- | layouts/partials/utils/content.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/partials/utils/content.html b/layouts/partials/utils/content.html index a1bf70b..05ec4c4 100644 --- a/layouts/partials/utils/content.html +++ b/layouts/partials/utils/content.html @@ -113,14 +113,14 @@ <!-- Image Hosting --> {{- if and .Site.Params.enableImageHost (eq hugo.Environment "production") -}} - {{- $hostURL := .Site.Params.imageHostURL -}} + {{- $hostURL := strings.TrimSuffix "/" .Site.Params.imageHostURL -}} {{- $temps := findRE `<(img) src="/?([^":]+)` $Content | uniq -}} {{- with $temps -}} {{- range . -}} {{- if not (in (slice "http" "ttps") (substr . -1 4)) -}} {{- $url := replaceRE `<(img) src="/?([^":]+)` `$2` . -}} {{- $prefix := replaceRE `(<(img) src=")/?([^":]+)` `$1` . -}} - {{- $replacement := (printf `%s%s%s` $prefix $hostURL $url) -}} + {{- $replacement := (printf `%s%s/%s` $prefix $hostURL $url) -}} {{- $Content = replace $Content . $replacement -}} {{- end -}} {{- end -}} |