I’d like to incorporate structured front matter tags to lock down the options available to authors. For example, I want each page to have a “tags” property with specific options. I’d also like each page to have a “last_reviewed” tag with a date in a specific format. How can enforce any kind of structure with my page content like this?
you could use Front Matter Defaults to passively dictate certain behavior.
With FMD,
defaults:
- scope:
path: ""
type: posts
values:
layout: post
read_time: true
categories: posts
- scope:
path: ""
type: pages
values:
layout: page
read_time: true
categories: pages
With the above, all posts will take on the post
layout, will have the time-to-read
feature active (requires plugins / 3rd-party-code) and the default url will have /posts/
prepended to it.
Similarly, all files with Front Matter dashes will take on the page
layout, have the time-to-read
feature enabled, and the default url will have /pages/
prepended to it.
Also available are site.tags
and site.categories
that’ll give you the list of all such variables defined for your site.
A
Thanks. I’m familiar with defaults and think they’re pretty nifty, but in this case, the values aren’t all the same. In particular, the last_modified tag or list of reviewers will vary by page.