소스 검색

Standardise image_filename page param to image; use for post type as well as image type

Used for og:image meta tag
master
Adrian Short 6 년 전
부모
커밋
c463ad7d90
5개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. +3
    -1
      README.md
  2. +2
    -2
      archetypes/images.md
  3. +2
    -0
      archetypes/posts.md
  4. +1
    -1
      layouts/partials/header.html
  5. +1
    -1
      layouts/partials/image.html

+ 3
- 1
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



+ 2
- 2
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:
---

+ 2
- 0
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:
---


+ 1
- 1
layouts/partials/header.html 파일 보기

@@ -9,7 +9,7 @@
<link rel="alternate" type="application/rss+xml" title="{{ partial "data/title" . }}"
href="{{ .RSSLink }}">
{{- template "_internal/opengraph.html" . -}}
{{ with .Params.image_filename }}
{{ with .Params.image }}
<meta name="og:image" content="{{ "/images/" | absURL }}{{ .}}">
{{ end }}
{{- template "_internal/twitter_cards.html" -}}


+ 1
- 1
layouts/partials/image.html 파일 보기

@@ -1,6 +1,6 @@
<figure>
<a href="{{ .Permalink | relURL }}">
<img src="{{ relURL "/images/" }}{{ .Params.image_filename }}" alt="{{ .Params.title }}">
<img src="{{ relURL "/images/" }}{{ .Params.image }}" alt="{{ .Params.title }}">
</a>
{{ if .Params.show_title }}
{{ with .Params.title }}<figcaption>{{ . }}</figcaption>{{ end }}


불러오는 중...
취소
저장