# Display first image in post in link preview

**URL:** <https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541>\
**Category:** support\
**Created:** [February 14, 2018, 6:21pm UTC](https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541 "2018-02-14T18:21:37Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 16, 2018, 12:56pm UTC](https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541/5 "2018-02-16T12:56:39Z")

</div>

> [@brunoamaral](#):
>
> that bit of code goes into the head of your single.html or a partial that is loaded in that section.

Note that Hugo ships with an internal opengraph template too. If you would like to use that, add below in the HTML head in your layout:

```auto
{{ template "_internal/opengraph.html" . }}

```

On similar notes, there’s `twitter_cards.html` internal template too.

* * *

Related:

> [@Links for images, videos, audio in internal templates twitter\_cards and opengraph](https://discourse.gohugo.io/t/links-for-images-videos-audio-in-internal-templates-twitter-cards-and-opengraph/10464/1):
>
> Hello, I was trying to use the internal twitter\_cards.html template and it didn’t work for me for 2 reasons: I am using the images front-matter to set the twitter:image meta data. The page was a bundle, so the full path of the page was something like content/posts/my-post/index.md, and I decided to keep the images in the bundle directory (though, not using the Resources method to fetch those for the meta data, as I don’t need image processing). So the path of an image from site root was /p…

---

_[View the full topic](https://discourse.gohugo.io/t/display-first-image-in-post-in-link-preview/10541)._
