Support setting "resources" in front-matter
kaushalmodi opened this issue · comments
This feature is upcoming in Hugo v0.33 (gohugoio/hugo@20c9b6e).
Example front-matter:
+++
date = 2017-01-17
title = "My Bundle With TOML Resource Metadata"
layout = "bundle-resource-meta"
[[resources]]
# The order matters
src = "image-4.png"
title = "TOML: The Fourth Image"
[[resources]]
src = "*.png"
name = "my-cool-image-:counter"
title = "TOML: The Image #:counter"
[resources.params]
byline = "bep"
+++
---
date: 2017-01-17
title: My Bundle With YAML Resource Metadata
layout: bundle-resource-meta
resources:
# The order matters
- src: "image-4.png"
title: "The Fourth Image"
- src: "*.png"
name: "my-cool-image-:counter"
title: "The Image #:counter"
params:
byline: "bep"
---
---
title: "Bundle Galore"
slug: pageslug
date: 2017-10-09
resources:
- src: "*.jpg"
name: "my-sunset-:counter"
title: "Sunset Galore :counter"
params:
myParam: "My Sunny Param"
---
Possible Org properties drawer syntax that would translate to:
[[resources]]
# The order matters
src = "image-4.png"
title = "TOML: The Fourth Image"
[[resources]]
src = "*.png"
name = "my-cool-image-:counter"
title = "TOML: The Image #:counter"
[resources.params]
byline = "bep"
Org
:PROPERTIES:
:EXPORT_HUGO_RESOURCES: :src "image-4.png" :title "TOML: The Fourth Image"
:EXPORT_HUGO_RESOURCES: :src "*.png" :name "my-cool-image-:counter" :title "TOML: The Image #:counter"
:EXPORT_HUGO_RESOURCES_PARAMS: :src "*.png" :byline "bep"
:END:
Somehow ensure that the order of the :src
in :EXPORT_HUGO_RESOURCES:
is retained.
Note
- Specifying
:src
is mandatory.. throw user-error in its absence.
There's a better way in Org:
:PROPERTIES:
:EXPORT_HUGO_RESOURCES: :src "image-4.png" :title "TOML: The Fourth Image"
:EXPORT_HUGO_RESOURCES+: :src "*.png" :name "my-cool-image-:counter" :title "TOML: The Image #:counter"
:EXPORT_HUGO_RESOURCES+: :src "*.png" :byline "bep"
:END:
Parameters that are not src
, name
or title
will be automatically put in params
.