aboutsummaryrefslogtreecommitdiffstats
path: root/aaoth_new_post.sh
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2022-04-19 00:24:23 +0300
committerla-ninpre <leobrekalini@gmail.com>2022-04-19 00:32:37 +0300
commit8d962aabf74c42c3afdc38f2f85fa7b06fd04ef0 (patch)
treee5054517b940e5c535a4c7282d7faa7b6462e794 /aaoth_new_post.sh
parent9f4b181b36418669462c0300c2e090d0f4547dc8 (diff)
downloadaaoth.xyz-8d962aabf74c42c3afdc38f2f85fa7b06fd04ef0.tar.gz
aaoth.xyz-8d962aabf74c42c3afdc38f2f85fa7b06fd04ef0.zip
reimplement website using shell scripts
major change, i know. now i'm using ssg and rssg by roman zolotarev. okay, well, not exactly. ssg is modified to generate pages for gemini too. it's hard to maintain two different things simultaneously. bye-bye jekyll!
Diffstat (limited to 'aaoth_new_post.sh')
-rwxr-xr-xaaoth_new_post.sh106
1 files changed, 0 insertions, 106 deletions
diff --git a/aaoth_new_post.sh b/aaoth_new_post.sh
deleted file mode 100755
index 8c2139f..0000000
--- a/aaoth_new_post.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/sh
-
-# quick and dirty script to add new posts to aaoth.xyz
-
-SITE_DIR="$HOME/Documents/aaoth.xyz"
-POSTS_DIR="$SITE_DIR/_posts"
-
-DATE_SHORT=$(date -I)
-DATE_LONG=$(date -Isec)
-
-usage() {
- echo "add a post to aaoth.xyz"
- echo
- echo "usage:"
- echo " $0 [OPTIONS]"
- echo
- echo "options:"
- echo " -t, --title <title>"
- echo " specify new post title"
- echo " -g, --tags <tags>"
- echo " specify new post tags"
- echo " -h, --help"
- echo " print usage information"
-}
-
-read_title() {
- echo "new post title: "
- read -r TITLE
-}
-
-read_tags() {
- echo "new post tags: "
- read -r TAGS
-}
-
-create_tag_page() {
- cat <<- TAG > "$SITE_DIR/tags/$1.md"
----
-layout: tagsort
-tag: $1
-title: "tags: $1"
-permalink: /tags/$1/
----
-TAG
-}
-
-cd "$SITE_DIR" || exit 1
-
-# if there are no arguments specified, run interactively
-if [ $# -gt 0 ]
-then
- while [ -n "$1" ]
- do
- case "$1" in
- --title|-t)
- shift
- TITLE=$1
- ;;
- --tags|-g)
- shift
- TAGS=$1
- ;;
- --help|-h)
- usage
- exit 2
- ;;
- *)
- usage
- exit 1
- ;;
- esac
- shift
- done
-fi
-
-[ -z "$TITLE" ] && read_title
-[ -z "$TITLE" ] && echo "title could not be empty" && exit 1
-
-[ -z "$TAGS" ] && read_tags
-[ -z "$TAGS" ] && echo "specify at least one tag" && exit 1
-
-TITLE_FILE=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')
-
-POST_FILENAME="$POSTS_DIR/$DATE_SHORT-$TITLE_FILE.md"
-
-for _tag in $TAGS
-do
- [ ! -f "./tags/$_tag.md" ] \
- && echo "tag $_tag is not present, creating one" \
- && create_tag_page "$_tag"
-done
-
-# template is currently hardcoded
-cat <<-EOF > "$POST_FILENAME"
----
-title: $TITLE
-date: $DATE_LONG
-author: la-ninpre
-tags: $TAGS
----
-
-<!--more-->
-
-EOF
-
-nvim -c "normal 6jo" -c "startinsert" "$POST_FILENAME"