Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting "resources" in front-matter #115

Closed
kaushalmodi opened this issue Jan 17, 2018 · 2 comments
Closed

Support setting "resources" in front-matter #115

kaushalmodi opened this issue Jan 17, 2018 · 2 comments

Comments

@kaushalmodi
Copy link
Owner

kaushalmodi commented Jan 17, 2018

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"
---
@kaushalmodi
Copy link
Owner Author

kaushalmodi commented Jan 17, 2018

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.

@kaushalmodi
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant