Open henningsway opened 6 years ago
+1 for this. I guess what needs to be done is integration with the OpenGraph protocol (promoted by Facebook, Twitter et al). There's a discussion going on here: https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541/5
Just for the record, I managed to do this by overriding head-open.html
in the layouts folder
:
<meta name="description" content="{{ .Description }}"/>
<meta name="og:type" content="website" />
<meta name="og:title" content="{{ .Title }}"/>
<meta name="og:description" content="{{ .Description }}"/>
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ .Description }}"/>
{{ with .Params.Images }}
{{ range first 1 . }}
<meta property="og:image" content="{{ . | absURL }}" />
<meta property="twitter:image:src" content="{{ . | absURL }}" />
{{ end }}
{{ end }}
This theme doesn't support images and I like it.
It would be nice for some posts to add an Image to the header of the file, which then gives a preview of the posts content, e.g. when viewed in an RSS-Reader. Would it be straightforward to build images like these into the theme (myself) and what would be the general way of doing this?