diff --git a/test/site/content-org/all-posts.org b/test/site/content-org/all-posts.org index c6b9685..f70c47a 100644 --- a/test/site/content-org/all-posts.org +++ b/test/site/content-org/all-posts.org @@ -1691,7 +1691,7 @@ The following results in the 'genres' property having the value [[https://github.com/kaushalmodi/ox-hugo/issues/99][Issue # 99]] * Resources :resources: ** TOML :toml: -*** Post with resources in front-matter +*** Post with resources in front-matter (TOML) :PROPERTIES: :EXPORT_FILE_NAME: resources-in-front-matter-toml :EXPORT_HUGO_RESOURCES: :src "image-4.png" :title "TOML: The Fourth Image" @@ -1722,11 +1722,61 @@ The following results in the 'genres' property having the value This is illegal --- You'll get a user-error. The =src= field *must* be specified for the =resources= front-matter. +*** Header image using Resources :header:image: +: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: +#+begin_description +Using the Hugo Resources feature for post header images. +#+end_description + +This test suggests an alternative way to do what the OP wants in +{{{oxhugoissue(139)}}}. + +Instead of having a TOML front-matter like: +#+begin_src conf-toml ++++ +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" ++++ +#+end_src + +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: +#+begin_src 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: +#+end_src ** YAML :yaml: :PROPERTIES: :EXPORT_HUGO_FRONT_MATTER_FORMAT: yaml :END: -*** Post with resources in front-matter +*** Post with resources in front-matter (YAML) :PROPERTIES: :EXPORT_FILE_NAME: resources-in-front-matter-yaml :EXPORT_HUGO_RESOURCES: :src "image-4.png" :title "The Fourth Image" diff --git a/test/site/content-org/images/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.jpg b/test/site/content-org/images/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.jpg new file mode 100755 index 0000000..0b3d091 Binary files /dev/null and b/test/site/content-org/images/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.jpg differ diff --git a/test/site/content/posts/header-image-using-resources/index.md b/test/site/content/posts/header-image-using-resources/index.md new file mode 100644 index 0000000..85367b7 --- /dev/null +++ b/test/site/content/posts/header-image-using-resources/index.md @@ -0,0 +1,53 @@ ++++ +title = "Header image using Resources" +author = ["Eastern Zhang"] +description = "Using the Hugo Resources feature for post header images." +date = 2018-03-01T00:10:00+08:00 +tags = ["resources", "toml", "header", "image"] +draft = false +[[resources]] + src = "stay_hungry*.jpg" + title = "Stay Hungry Stay Foolish" + [resources.params] + credit = "quotefancy.com" + caption = "Stay Hungry Stay Foolish" + url = "https://quotefancy.com/quote/13609/Steve-Jobs-Stay-hungry-Stay-foolish" ++++ + +This test suggests an alternative way to do what the OP wants in +`ox-hugo` Issue #[139](https://github.com/kaushalmodi/ox-hugo/issues/139). + +Instead of having a TOML front-matter like: + +```conf-toml ++++ +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: + +```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: +``` diff --git a/test/site/content/posts/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg b/test/site/content/posts/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg new file mode 120000 index 0000000..8c53b14 --- /dev/null +++ b/test/site/content/posts/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.featured.jpg @@ -0,0 +1 @@ +../../../content-org/images/header-image-using-resources/stay_hungry_stay_foolish__quotefancy_dot_com.jpg \ No newline at end of file diff --git a/test/site/content/posts/resources-in-front-matter-toml.md b/test/site/content/posts/resources-in-front-matter-toml.md index 8b5de8f..435d101 100644 --- a/test/site/content/posts/resources-in-front-matter-toml.md +++ b/test/site/content/posts/resources-in-front-matter-toml.md @@ -1,5 +1,5 @@ +++ -title = "Post with resources in front-matter" +title = "Post with resources in front-matter (TOML)" tags = ["resources", "toml"] draft = false [[resources]] diff --git a/test/site/content/posts/resources-in-front-matter-yaml.md b/test/site/content/posts/resources-in-front-matter-yaml.md index 889fa6b..957df76 100644 --- a/test/site/content/posts/resources-in-front-matter-yaml.md +++ b/test/site/content/posts/resources-in-front-matter-yaml.md @@ -1,5 +1,5 @@ --- -title: "Post with resources in front-matter" +title: "Post with resources in front-matter (YAML)" tags: ["resources", "yaml"] draft: false resources: diff --git a/test/site/themes/bare_min b/test/site/themes/bare_min index d194f70..fb71bfd 160000 --- a/test/site/themes/bare_min +++ b/test/site/themes/bare_min @@ -1 +1 @@ -Subproject commit d194f70dedf4e777d9115e19fcbeefb880c6deb5 +Subproject commit fb71bfd8b53416d1d100e3ad04c3ad4daa3b2ced