New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to include a picture for posts to show up in RSS-Reader? #61

Open
henningsway opened this Issue Mar 9, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@henningsway
Copy link

henningsway commented Mar 9, 2018

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?

@PaulRBerg

This comment has been minimized.

Copy link

PaulRBerg commented Dec 24, 2018

+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

@PaulRBerg

This comment has been minimized.

Copy link

PaulRBerg commented Dec 26, 2018

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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment