use permalink for page bundle images

This commit is contained in:
Gabriele Musco 2022-10-25 07:07:20 +02:00
parent 3706ace5e8
commit 49eb66136e
No known key found for this signature in database
GPG Key ID: 1068D795C80E51DE
7 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join "/" (path.Join .File.Dir .Params.Image) }}
{{ $image = print .Permalink "/" .Params.Image }}
{{ end }}
{{ end }}
{{ $mscratch.Add "articles" (dict

View File

@ -16,7 +16,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join (path.Join .File.Dir .Params.Image) }}
{{ $image = print .Permalink "/" .Params.Image }}
{{ end }}
{{ end }}
{{ $mscratch.Add "articles" (dict

View File

@ -20,7 +20,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
<img src="{{ .Params.Image }}" alt="{{ .Params.Alt }}" />
{{ else }}
<img src="/{{ path.Join .File.Dir .Params.Image }}" alt="{{ .Params.Alt }}" />
<img src="{{ .Permalink }}/{{ .Params.Image }}" alt="{{ .Params.Alt }}" />
{{ end }}
</a>
{{ end }}

View File

@ -5,7 +5,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join "/" (path.Join .File.Dir .Params.Image) }}
{{ $image = print .Permalink "/" .Params.Image }}
{{ end }}
{{ end }}
<a class="featuredCardLink" href="{{ .Permalink }}">

View File

@ -20,7 +20,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join (path.Join .File.Dir .Params.Image) }}
{{ $image = print .Permalink "/" .Params.Image }}
{{ end }}
{{ end }}
<meta property="og:image"

View File

@ -12,7 +12,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
{{ $image = .Params.Image }}
{{ else }}
{{ $image = path.Join (path.Join .File.Dir .Params.Image) }}
{{ $image = print .Permalink "/" .Params.Image }}
{{ end }}
{{ end }}
<meta name="twitter:image"

View File

@ -17,7 +17,7 @@
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
<img src="{{ .Params.Image }}" alt="{{ .Params.Alt }}" />
{{ else }}
<img src="/{{ path.Join .File.Dir .Params.Image }}" alt="{{ .Params.Alt }}" />
<img src="{{ .Permalink }}/{{ .Params.Image }}" alt="{{ .Params.Alt }}" />
{{ end }}
{{ if .Params.ImageCaption }}
<figcaption>