blog

git clone https://git.ce9e.org/blog.git

commit
249b98975c882cc89c88e8fe1b7f21920d4fffca
parent
e45992eadf93ad47257e963df33d44d6533ba1ae
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-07-22 12:06
allow to mark posts as draft

Diffstat

M feed-atom.sh 5 +++++
M feed-json.sh 6 +++++-
M posts.sh 6 +++++-

3 files changed, 15 insertions, 2 deletions


diff --git a/feed-atom.sh b/feed-atom.sh

@@ -29,8 +29,13 @@ fi
   29    29 
   30    30 ls _content/posts | tac | $select | while read -r l; do
   31    31 	yml="_content/posts/$l/index.md"
   -1    32 	if grep -q 'draft: true' "$yml"; then
   -1    33 		continue
   -1    34 	fi
   -1    35 
   32    36 	html="_content/posts/$l/index.html"
   33    37 	url="${base_url}posts/$l/"
   -1    38 
   34    39 	echo '	<entry>'
   35    40 	echo "		<title>$(getyml 'title' "$yml" | escape)</title>"
   36    41 	echo "		<link href=\"$url\" />"

diff --git a/feed-json.sh b/feed-json.sh

@@ -29,6 +29,11 @@ else
   29    29 fi
   30    30 
   31    31 ls _content/posts | tac | $select | while read -r l; do
   -1    32 	yml="_content/posts/$l/index.md"
   -1    33 	if grep -q 'draft: true' "$yml"; then
   -1    34 		continue
   -1    35 	fi
   -1    36 
   32    37 	if [ -z "$loop" ]; then
   33    38 		echo '	"items": [{'
   34    39 		loop=1
@@ -36,7 +41,6 @@ ls _content/posts | tac | $select | while read -r l; do
   36    41 		echo '	}, {'
   37    42 	fi
   38    43 
   39    -1 	yml="_content/posts/$l/index.md"
   40    44 	html="_content/posts/$l/index.html"
   41    45 	url="${base_url}posts/$l/"
   42    46 	value 2 'title' "$(getyml 'title' "$yml" | escape)"

diff --git a/posts.sh b/posts.sh

@@ -7,6 +7,11 @@ getyml() {
    7     7 prev_year=''
    8     8 
    9     9 ls _content/posts | tac | while read -r l; do
   -1    10 	yml="_content/posts/$l/index.md"
   -1    11 	if grep -q 'draft: true' "$yml"; then
   -1    12 		continue
   -1    13 	fi
   -1    14 
   10    15 	year=$(echo "$l" | cut -d- -f1)
   11    16 	if [ "$year" != "$prev_year" ]; then
   12    17 		echo
@@ -15,7 +20,6 @@ ls _content/posts | tac | while read -r l; do
   15    20 		prev_year="$year"
   16    21 	fi
   17    22 
   18    -1 	yml="_content/posts/$l/index.md"
   19    23 	echo "- [$(getyml 'title' "$yml")](/posts/$l/){data-tags=\"$(getyml 'tags' "$yml" | sed 's/^\[\(.*\)\]$/\1/;s/, */ /g')\"}"
   20    24 done
   21    25