bridgetown
bridgetown copied to clipboard
feat: Add config option that allows template engine to process pages without frontmatter
Summary
Add a configuration option that allows the default template engine to process files without frontmatter.
Motivation
Many basic sites don't need front matter. Requiring an empty front-matter section on each page adds conceptual overhead and a potential pitfall. It would be handy to be able to remove this requirement with a config option.
Guide-level explanation
Normally, you must include a front-matter section for your html files to be processed by the template engine (it can be empty).
If you would like the template engine to process all .html files, add the following to your bridgetown.config.yml
apply_template_engine_to_files_without_frontmatter: true
Reference-level explanation
Setting the configuration option would mean that the template engine would process files without frontmatter.
Drawbacks
None that I can think of
Unresolved Questions
Should this only apply to .html files or those with a recognized template extension?
Should we allow users to set this per-folder with scopes or defaults.yml (similar to setting a default template engine)
This would likely be a place to start in terms of adding additional conditional logic here: https://github.com/bridgetownrb/bridgetown/blob/a1de6d1b7d31fdc7dcc15b0b200de6541982e6a7/bridgetown-core/lib/bridgetown-core/collection.rb#L73
I don't think we can blanket have a site-wide configuration option to change this behavior. More like we'd support some kind of glob, like:
process_files_without_frontmatter:
- "_pages/info/**.md"