Display first image in post in link preview

I’m guessing you are talking about open graph tags. You need to have meta tags on the section of your html.

It looks like this
<meta property="og:image" content="{{ .Site.BaseURL}}images/logo.png" />

If you want to ‘fetch’ the first image you can do something like this:

	{{ with .Params.images }}
		{{ range first 1 . }}
	<meta property="og:image" content="{{ . | absURL }}" />
		{{ end }}
	{{ end }}

I didn’t test it, but i think it was working on a previous installment of my blog.

1 Like