borkdude / quickblog

Light-weight static blog engine for Clojure and babashka
https://blog.michielborkent.nl/
MIT License
165 stars 28 forks source link

Support using a template for `quickblog new` #87

Open jmglov opened 7 months ago

jmglov commented 7 months ago

When creating a new post, I would like to have it look something like this:

Title: Test
Date: 2024-01-19
Tags: clojure
Image: assets/test-preview.png
Image-Alt: FIXME
Discuss: FIXME
Preview: true

Write a blog post here!

Instead of the boring quickblog default:

Title: Test
Date: 2024-01-19
Tags: clojure

Write a blog post here!

If I could but say something like this:

bb quickblog new --file "test.md" --title "Test" --preview --template-file new-post.md

assuming I have a new-post.md template that looks like this:

Title: {{title}}
Date: {{date}}
Tags: {{tags|join:\",\"}}
Image: {% if image %}{{image}}{% else %}{{assets-dir}}/{{file|replace:.md:}}-preview.png{% endif %}
Image-Alt: {{image-alt|default:FIXME}}
Discuss: {{discuss|default:FIXME}}
{% if preview %}Preview: true\n{% endif %}
Write a blog post here!

I would truly be the happiest of men!