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

Allow adding custom front matter to posts #48

Closed
punchagan opened this issue Jul 24, 2017 · 4 comments
Closed

Allow adding custom front matter to posts #48

punchagan opened this issue Jul 24, 2017 · 4 comments

Comments

@punchagan
Copy link
Contributor

punchagan commented Jul 24, 2017

Some themes allow using custom front matter fields, other than the standard ones -- for example this theme (screenshot) allows marking posts as best posts

There could be a convention for the headline properties to add these custom fields - something like :EXPORT_FRONT_MATTER_{KEY}: value exporting to key = "value"

@kaushalmodi
Copy link
Owner

I don't know how to make the KEY portion in :EXPORT_FRONT_MATTER_{KEY}: value dynamic. My understanding is that all the backend keywords need to be defined in the :options-alist section of the definition.

This, though, has been on my list. I was thinking of implementing the same way :HUGO_MENU is implemented:

** Menu Meta Data in TOML Front Matter
:PROPERTIES:
:EXPORT_HUGO_MENU: :menu "something here" :weight 80 :parent posts :identifier foo1
:END:

Along the similar lines, we could have :HUGO_CUSTOM_FRONT_MATTER:

** Menu Meta Data in TOML Front Matter
:PROPERTIES:
:EXPORT_HUGO_CUSTOM_FRONT_MATTER: :foo bar :baz zoo
:END:

I would then parse that using a very similar (generalized) version of this.

Planning to tackle #37 the same way.

WDYT?

@punchagan
Copy link
Contributor Author

I wasn't aware that backend keywords need to be defined in the :options-alist, and I hadn't yet gotten to looking at the Menu front matter implementation.

This seems like a reasonable way of doing it, especially given that another feature is already using this format/syntax.

@kaushalmodi
Copy link
Owner

kaushalmodi commented Jul 24, 2017

I have implemented this in 8c97677.

Check out the example in that commit. You can close this issue if this works for you.

@punchagan
Copy link
Contributor Author

That was quick, and works beautifully! Thanks!

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

2 participants