.Kind (page): .Type (posts) / .Layout ()
Bundle: leaf
[ categories | tags | search ]
ox-hugo Test Site

This is the test site for the ox-hugo package for Emacs/Org-mode.

It is updated automatically after each commit to the ox-hugo repo. It was last updated on Oct 05, 2024 21:20 UTC.


This page was created/modified in commit f54b484 "Fix a test" on 2022-01-11.
Markdown source of this page

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)
KeyTypeValue
captionstring "Stay Hungry Stay Foolish"
creditstring "quotefancy.com"
urlstring "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 VariableValue
Name "Header image using Resources"
Title "Header image using Resources"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/header-image-using-resources/"
RelPermalink "/posts/header-image-using-resources/"
Data
page.Data{} (type:page.Data)
NextPageHUGO_DRAFT true, DONE state (Override)
PrevPageDate and slug inheritance (English)
NextInSectionHUGO_DRAFT true, DONE state (Override)
PrevInSectionDate and slug inheritance (English)

Page Params (Debug)

KeyTypeValue
author[]string "Eastern Zhang"
datetime.Time 2018-03-01 00:10:00 +0800 +0800
descriptionstring "Using the Hugo Resources feature for post header images."
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-01-11 16:04:17 -0500 -0500
publishdatetime.Time 2018-03-01 00:10:00 +0800 +0800
resources[]map[string]interface {}
KeyTypeValue
paramsmap[string]interface {}
KeyTypeValue
captionstring "Stay Hungry Stay Foolish"
creditstring "quotefancy.com"
urlstring "https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"
srcstring "stay_hungry*.jpg"
titlestring "Stay Hungry Stay Foolish"
tags[]string "resources" "toml" "header" "image"
titlestring "Header image using Resources"

Resources (Debug)

Resource VariableValue
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
KeyTypeValue
captionstring "Stay Hungry Stay Foolish"
creditstring "quotefancy.com"
urlstring "https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish"

File Object (Debug)

FileInfo VariableValue
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"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.101.0 (commit 466fa43c16709b4483689930a4f9ac8add5c9f66) . This site is powered by Netlify.
[Test Site home | ox-hugo home]