Fix newposts' TOML string quoting and slugification.
This commit is contained in:
parent
0ca6dee8d4
commit
3f1c339cd8
|
@ -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 = []
|
||||
+++
|
||||
|
||||
|
|
Loading…
Reference in a new issue