Fix newposts' TOML string quoting and slugification.

This commit is contained in:
Jessica Canady 2024-01-30 16:46:16 -05:00
parent 0ca6dee8d4
commit 3f1c339cd8

View file

@ -5,20 +5,19 @@ set -e
cd "$(dirname "$0")/../"
TITLE=$1
SLUG=echo $TITLE | iconv -t ascii//TRANSLIT | sed -r s/[~\^]+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z~
echo $SLUG
exit
SLUG=$(echo $TITLE | iconv -t ascii//TRANSLIT | sed -r s/[~\^]+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
PUBLISH_DATE=$(date --rfc-3339=seconds)
FILEPATH="./content/blog/$SLUG.md"
if [ ! -e $FILEPATH ]; then
cat > $FILEPATH <<-EOF
+++
title = $TITLE
title = "$TITLE"
date = $PUBLISH_DATE
draft = false
[taxonomies]
# these go in quotes, like the title
tags = []
+++