Adding og:image parameter to single

Would be nice to add teh meta of:image to the single post so the cover image can be the image highlight when sharing the post

Read:
https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541
pull/361/head
Carlos Gutiérrez Moreno 2022-11-10 10:11:44 +01:00 committed by GitHub
parent 2977412974
commit 598e323991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -4,6 +4,7 @@
{{- $feature := $images.GetMatch "*feature*" | default $cover }}
<article>
<header class="max-w-prose">
<meta property="og:image" content="{{ $feature.RelPermalink | absURL }}" />
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
{{ partial "breadcrumbs.html" . }}
{{ end }}