diff --git a/README.md b/README.md index f2985fe..943c150 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ A single image with an optional caption (the `title`) and body text. # 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. @@ -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. $ 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 diff --git a/archetypes/images.md b/archetypes/images.md index 7aab5a5..7057b76 100644 --- a/archetypes/images.md +++ b/archetypes/images.md @@ -3,8 +3,8 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} draft: false 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 tags: --- diff --git a/archetypes/posts.md b/archetypes/posts.md index 2c6d04d..5fb0e70 100644 --- a/archetypes/posts.md +++ b/archetypes/posts.md @@ -2,6 +2,8 @@ title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} draft: true +# image is relative to /static/images/ +image: {{ .TranslationBaseName }}.jpg type: post tags: --- diff --git a/layouts/partials/header.html b/layouts/partials/header.html index d0c8b5f..36ec3e6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -9,7 +9,7 @@ {{- template "_internal/opengraph.html" . -}} - {{ with .Params.image_filename }} + {{ with .Params.image }} {{ end }} {{- template "_internal/twitter_cards.html" -}} diff --git a/layouts/partials/image.html b/layouts/partials/image.html index 88e1add..e99adbe 100644 --- a/layouts/partials/image.html +++ b/layouts/partials/image.html @@ -1,6 +1,6 @@
- {{ .Params.title }} + {{ .Params.title }} {{ if .Params.show_title }} {{ with .Params.title }}
{{ . }}
{{ end }}