Closed jaredcwhite closed 2 years ago
After much time reflecting, I'm now leaning in a much more DSL-like direction…something more akin to:
site do
url "https://jaredwhite.com"
timezone "America/Los_Angeles"
environment :development do
bind "ssl://0.0.0.0:4000"
end
end
content do
permalink :simple
template_engine :serbea
end
collection :now_entries do
sort direction: :descending
end
collection :newsletters do
disable_output
sort direction: :descending
end
collection :events do
front_matter do
layout :event
end
end
pagination :enable do
title ":title (pg. :num)"
per_page 15
end
Otherwise if it's just basic key/value hashes sort of style we might as well stick with simple YAML.
ALSO: if we were to go in this direction, I'd deprecate and eventually drop the YAML format. It seems like madness to have two completely different config formats and support both indefinitely.
Another idea: keep bridgetown.config.yml
as a basic entrypoint, but optionally allow any config/*.config.rb
files be processed as configuration using a DSL like the above. (Maybe we could support config/*.config.yml
too.) The nice thing about this idea is that any automation or plugin gem which needs to generate configuration could create new files in that folder, rather than editing bridgetown.config.yml. In fact it makes sense to "block" that file from ever getting edited by anything other than manually by the site owner.
Something along these lines is now available as the Initializers format in Bridgetown 1.2!
May 2022 Update: See Below
As an alternative (not a replacement!)to Bridgetown's YAML format for the configuration file, we could offer a Ruby-based configuration file (bridgetown.config.rb
). It might be something as simple as:Feedback and further thoughts encouraged!