Header image using Resources
tags :
resources
toml
header
image
Description/Summary
Using the Hugo Resources feature for post header images.
Featured/Header Image
Stay Hungry Stay Foolish
(Credit: quotefancy.com )
Featured Resource Params (Debug)
Key Type Value
caption string
"Stay Hungry Stay Foolish"
credit string
"quotefancy.com"
url string
"https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"
Content
This test suggests an alternative way to do what the OP wants in
ox-hugo
Issue #139 .
Instead of having a TOML front-matter like:
+++
title = "fourth test"
author = [ "Eason Zhang" ]
date = 2018-03-01T00:10:00+08:00
lastmod = 2018-03-01T00:18:00+08:00
tags = [ "project" ]
draft = true
summary = "summary"
image_preview = "projects/bubbles.jpg"
[ header ]
image = "projects/Readingabook.jpg"
caption = "stay hungry, stay foolish"
+++
this post shows an example of doing something similar by exporting the
post as a Page Bundle and using the Resources feature. Here’s how
the resource config and other front-matter is set in Org:
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: header-image-using-resources
:EXPORT_FILE_NAME: index
:EXPORT_AUTHOR: Eastern Zhang
:EXPORT_DATE: 2018-03-01T00:10:00+08:00
:EXPORT_HUGO_RESOURCES: :src "stay_hungry*.jpg" :title "Stay Hungry Stay Foolish"
:EXPORT_HUGO_RESOURCES+: :caption "Stay Hungry Stay Foolish"
:EXPORT_HUGO_RESOURCES+: :credit "quotefancy.com"
:EXPORT_HUGO_RESOURCES+: :url "https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"
:END:
Resources
Page (Debug)
Page Params (Debug)
Key Type Value
author []string
"Eastern Zhang"
date time.Time
2018-03-01 00:10:00 +0800 +0800
description string
"Using the Hugo Resources feature for post header images."
draft bool
false
iscjklanguage bool
false
lastmod time.Time
2022-01-11 16:04:17 -0500 -0500
publishdate time.Time
2018-03-01 00:10:00 +0800 +0800
resources []map[string]interface {}
Key Type Value
params map[string]interface {}
Key Type Value
caption string
"Stay Hungry Stay Foolish"
credit string
"quotefancy.com"
url string
"https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"
src string
"stay_hungry*.jpg"
title string
"Stay Hungry Stay Foolish"
tags []string
"resources"
"toml"
"header"
"image"
title string
"Header image using Resources"
Resources (Debug)
Resource Variable Value
Name
"stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg"
Title
"Stay Hungry Stay Foolish"
ResourceType
"image"
Permalink
"https://ox-hugo.scripter.co/test/posts/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg"
RelPermalink
"/posts/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg"
Params
Key Type Value
caption string
"Stay Hungry Stay Foolish"
credit string
"quotefancy.com"
url string
"https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"
File Object (Debug)
FileInfo Variable Value
UniqueID
"0ddad87bb7ef60b31272b1b17e00fc77"
BaseFileName
"index"
TranslationBaseName
"index"
Lang
"en"
Section
"posts"
LogicalName
"index.md"
Dir
"posts/header-image-using-resources/"
Ext
"md"
Path
"posts/header-image-using-resources/index.md"