From e9044cd87daabcb83522a68732e0b96189baf854 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 19 Nov 2022 10:52:17 +0000 Subject: add DRAFT feature --- README.md | 4 ++++ lib/atomfeed.source.sh | 1 + lib/gemfeed.source.sh | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b744c7..663fab4 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,10 @@ Once all of that is done, the `gemtexter` script will convert the new post (plus You can also have a look at `$BASE_CONTENT_DIR/meta/gemfeed`. There is a metafile for each blog post stored. These metafiles are required for the generation of the Atom feed. You can edit these metafiles manually and run `./gemtexter --generate` or `./gemtexter --feed` again if you want to change some of the Atom feed content. +## Drafting a blog post before publishing it + +If you don't want to publish your article yet (e.g. don't advertise it on the Gemfeed and Atom feed yet), you can draft your article in `./gemtext/gemfeed/DRAFT-article-title-dash-separated.gmi`. Gemtexter will still generate all output formats of the draft, but your site visitors won't be aware of it. Once you want to publish your draft just rename `DRAFT` with the publishing date `YYYY-MM-DD` and from there everything works normally. + ## Ready to be published After running `./gemtexter --generate`, you will have all static files ready to be published. But before you do that, you could preview the content with `firefox ../foo.zone-content/html/index.html` or `glow ../foo.zone-content/md/index.md` (you get the idea). diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh index c5e492f..65afa5a 100644 --- a/lib/atomfeed.source.sh +++ b/lib/atomfeed.source.sh @@ -88,6 +88,7 @@ atomfeed::generate () { local -r atom_file="$gemfeed_dir/atom.xml" local -r now=$($DATE --iso-8601=seconds) + log INFO "Generating Atom feed to $atom_file" log INFO 'This may takes a while with an empty cache....' diff --git a/lib/gemfeed.source.sh b/lib/gemfeed.source.sh index 8eaeb95..6cb9a5a 100644 --- a/lib/gemfeed.source.sh +++ b/lib/gemfeed.source.sh @@ -3,7 +3,7 @@ gemfeed::get_posts () { local -r gemfeed_dir="$CONTENT_BASE_DIR/gemtext/gemfeed" local -r gmi_pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}-.*\.gmi$' - ls "$gemfeed_dir" | $GREP -E "$gmi_pattern" | sort -r + ls "$gemfeed_dir" | $GREP -f -v DRAFT- | $GREP -E "$gmi_pattern" | sort -r } # Add the links from gemfeed/index.gmi to the main index site. -- cgit v1.2.3