12 lines
436 B
HTML
12 lines
436 B
HTML
<!-- https://gohugo.io/functions/findre/ -->
|
|
<!-- https://gohugo.io/functions/replacere/ -->
|
|
<!-- https://regex101.com/ -->
|
|
{{- $imgs := slice -}}
|
|
{{- if and .IsPage (in .Site.Params.mainSections .Section) -}}
|
|
{{- range (findRE `<img src="/?([^"]+)` .Content | uniq) -}}
|
|
{{- $url := replaceRE `<img src="/?([^"]+)` `$1` . -}}
|
|
{{- $imgs = union $imgs (slice $url) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- return $imgs -}}
|