Used for og:image meta tagmaster
@@ -48,7 +48,7 @@ A single image with an optional caption (the `title`) and body text. | |||||
# hugo new images/my-image-title.md | # hugo new images/my-image-title.md | ||||
Then copy the image file itself to `/static/images/` and update `image_filename` in the front matter if required. | |||||
Then copy the image file itself to `/static/images/` and update `image` in the front matter if required. | |||||
Set `show_title: true` to display the `title` as a caption beneath the image. | Set `show_title: true` to display the `title` as a caption beneath the image. | ||||
@@ -57,6 +57,8 @@ Set `show_title: true` to display the `title` as a caption beneath the image. | |||||
A traditional blog post with mandatory title and body text. | A traditional blog post with mandatory title and body text. | ||||
$ hugo new posts/my-post-title.md | $ hugo new posts/my-post-title.md | ||||
Use the `image` field in the front matter to set the featured image for your post. This currently is only shown in the OpenGraph metadata, not on your site itself. If you want an image to show in the list views on your site, put it at the top of your post. | |||||
### Quotes | ### Quotes | ||||
@@ -3,8 +3,8 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}" | |||||
date: {{ .Date }} | date: {{ .Date }} | ||||
draft: false | draft: false | ||||
type: image | type: image | ||||
# image_filename is relative to /static/images/ | |||||
image_filename: {{ .TranslationBaseName }}.jpg | |||||
# image is relative to /static/images/ | |||||
image: {{ .TranslationBaseName }}.jpg | |||||
show_title: false | show_title: false | ||||
tags: | tags: | ||||
--- | --- |
@@ -2,6 +2,8 @@ | |||||
title: "{{ replace .TranslationBaseName "-" " " | title }}" | title: "{{ replace .TranslationBaseName "-" " " | title }}" | ||||
date: {{ .Date }} | date: {{ .Date }} | ||||
draft: true | draft: true | ||||
# image is relative to /static/images/ | |||||
image: {{ .TranslationBaseName }}.jpg | |||||
type: post | type: post | ||||
tags: | tags: | ||||
--- | --- | ||||
@@ -9,7 +9,7 @@ | |||||
<link rel="alternate" type="application/rss+xml" title="{{ partial "data/title" . }}" | <link rel="alternate" type="application/rss+xml" title="{{ partial "data/title" . }}" | ||||
href="{{ .RSSLink }}"> | href="{{ .RSSLink }}"> | ||||
{{- template "_internal/opengraph.html" . -}} | {{- template "_internal/opengraph.html" . -}} | ||||
{{ with .Params.image_filename }} | |||||
{{ with .Params.image }} | |||||
<meta name="og:image" content="{{ "/images/" | absURL }}{{ .}}"> | <meta name="og:image" content="{{ "/images/" | absURL }}{{ .}}"> | ||||
{{ end }} | {{ end }} | ||||
{{- template "_internal/twitter_cards.html" -}} | {{- template "_internal/twitter_cards.html" -}} | ||||
@@ -1,6 +1,6 @@ | |||||
<figure> | <figure> | ||||
<a href="{{ .Permalink | relURL }}"> | <a href="{{ .Permalink | relURL }}"> | ||||
<img src="{{ relURL "/images/" }}{{ .Params.image_filename }}" alt="{{ .Params.title }}"> | |||||
<img src="{{ relURL "/images/" }}{{ .Params.image }}" alt="{{ .Params.title }}"> | |||||
</a> | </a> | ||||
{{ if .Params.show_title }} | {{ if .Params.show_title }} | ||||
{{ with .Params.title }}<figcaption>{{ . }}</figcaption>{{ end }} | {{ with .Params.title }}<figcaption>{{ . }}</figcaption>{{ end }} | ||||