One-click draft blog post in Github (for Eleventy)
In Github, you can create new files via a url link, and thus we can create new blog posts easily in Eleventy.
For a draft post, you will need these two keys and values in the front matter:
---
eleventyExcludeFromCollections: true
permalink: false
---
Format
The format for creating a new file is thus:
https:
Substitute the upper-case values accordingly.
To fill in SOME_VALUE
with the front matter needed for a draft blog post, we have to URI encode this:
---
eleventyExcludeFromCollections: true
permalink: false
title: your title here
---
Your draft text here.
into this:
How
Use the encodeURI function to encode the text. Then take this value and substitute SOME_VALUE
with it, construct the url, then save it as a bookmark.
You can even assign a hotkey for it, see this method.
Credits
- Reuben L. Lillie - for the url formatting code for Eleventy, so the long urls above will wrap nicely in the browser.
- Peter deHaan - for the two front-matter keys and values to make a post in “draft mode”