Skip to content

Commit

Permalink
fix(#117): fix featuredImage param 404 error
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed Jun 24, 2021
1 parent 40dcdae commit 11d375a
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 47 deletions.
4 changes: 1 addition & 3 deletions exampleSite/content/posts/basic-markdown-syntax/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "This article shows the basic Markdown syntax and format."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["Markdown", "HTML"]
categories: ["Markdown"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "这篇文章展示了基本的 Markdown 语法和格式."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["Markdown", "HTML"]
categories: ["Markdown"]
Expand Down
4 changes: 1 addition & 3 deletions exampleSite/content/posts/emoji-support/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Guide to emoji usage in Hugo and DoIt."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["emoji"]
categories: ["Markdown"]
Expand Down
4 changes: 1 addition & 3 deletions exampleSite/content/posts/emoji-support/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Hugo 和 DoIt 中的 Emoji 的用法指南."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["emoji"]
categories: ["Markdown"]
Expand Down
4 changes: 1 addition & 3 deletions exampleSite/content/posts/pwa-support/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "PCloud"
authorLink: "https://github.com/HEIGE-PCloud"
description: "Guide to setup PWA in DoIt"
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["PWA"]
categories: ["Documentation"]
Expand Down
4 changes: 1 addition & 3 deletions exampleSite/content/posts/pwa-support/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "PCloud"
authorLink: "https://github.com/HEIGE-PCloud"
description: "Guide to setup PWA in DoIt"
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["PWA"]
categories: ["Documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Discover what the Hugo - DoIt theme is all about and the core-concepts behind it."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["installation", "configuration"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "探索 Hugo - DoIt 主题的全部内容和背后的核心概念."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["installation", "configuration"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Hugo provides multiple built-in shortcodes for author convenience and to keep your markdown content clean."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["shortcodes"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Hugo 提供了多个内置的 Shortcodes, 以方便作者保持 Markdown 内容的整洁."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["shortcodes"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "Find out how to create and organize your content quickly and intuitively in DoIt theme."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["content", "Markdown"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "了解如何在 DoIt 主题中快速, 直观地创建和组织内容."
resources:
- name: "featured-image"
src: "featured-image.webp"
featuredImage: "featured-image.webp"

tags: ["content", "Markdown"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ author: "Dillon"
authorLink: "https://dillonzq.com"
description: "DoIt theme provides multiple shortcodes on top of built-in ones in Hugo."
resources:
- name: "featured-image"
src: "featured-image.webp"
- name: "featured-image-preview"
src: "featured-image-preview.webp"
featuredImage: "featured-image.webp"
featuredImagePreview: "featured-image-preview.webp"

tags: ["shortcodes"]
categories: ["documentation"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "DoIt 主题在 Hugo 内置的 shortcode 的基础上提供多个扩展的 shortcode."
resources:
- name: "featured-image"
src: "featured-image.webp"
- name: "featured-image-preview"
src: "featured-image-preview.webp"
featuredImage: "featured-image.webp"
featuredImagePreview: "featured-image-preview.webp"

tags: ["shortcodes"]
categories: ["documentation"]
Expand Down
9 changes: 7 additions & 2 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

<article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
{{- $image := $params.featuredImagePreview | default $params.featuredImage -}}
{{- $height := "auto" -}}
{{- $width := "auto" -}}
{{- with .Resources.GetMatch (printf "%s" ($image)) -}}
{{- $image = .RelPermalink -}}
{{- $height = .Height -}}
{{- $width = .Width -}}
{{- end -}}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- $height = .Height -}}
{{- $width = .Width -}}
{{- end -}}
{{- end -}}
{{- with .Resources.GetMatch "featured-image-preview" -}}
{{- $image = .RelPermalink -}}
{{- $height = .Height -}}
Expand Down

0 comments on commit 11d375a

Please sign in to comment.