Ignore underscored directories by default & add a "post_path" attribute #119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tl;dr
_posts
areposts
now and everything with an underscore is considered meta-dataThis is something I've been meaning to do for a long time now.
I would like to add consistency in how we deal with files and folders
that have a leading dot or underscore. This commit makes it so that both
kinds are simply ignored by default when looking for documents to
generate or assets to copy. I like to see those filenames as
indication that the folders contain "meta" information.
My idea of a good site generator is that your source file structure is
not fundamentally different from the resulting file structure. You
basically end up with the same structure but "enhanced" by the site
generator (e.g. by turning .md and .liquid files into .html files).
It is very useful to have an easy indicator like an underscore to show
that this file will be used in the generation process but will not be
there in the resulting site. You can now simply have a file called _data.json
next to your template or blog file.
The default post path has been changed to "posts".
For compatibility it is still possible to set your default post path to
"_posts", however, you now have to do it explicitly in your .cobalt.yml.
This is good, as having _posts/blog-post.md generate to
_posts/blog-post.html was just laughable.
I will make PRs for that in all affected user pages.
(Most of them already specify a different posts directory, so nothing should change).
_layouts obviously stays the same. I changed the layout handling a
bit, though. Layouts are now read from disk every time they are
required. This needs a bit of optmization in the future but allows for
better and more flexible layout specification.
Furthermore, users can now specify a
post_path
in their .cobalt.yml, which is the globalfallback for the
path
attribute in post front matter (called permalink in Jekyll). I feel like thesetwo changes finally give us both an easy but also flexible post writing experience.