Skip to content

Commit 32ca3ae

Browse files
committed
Add script to start blog post
1 parent aa3a03a commit 32ca3ae

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ devenv.local.nix
99
.pre-commit-config.yaml
1010

1111
public/
12+
13+
*.swp
14+
*.swo
15+
*~

public/elasticlunr.min.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

public/greyscale_portrait.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/new

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
3+
4+
slugify() {
5+
local string="$1"
6+
echo "$string" | tr '[:upper:]' '[:lower:]' | tr -s ' ' '-' | tr -cd '[:alnum:]-'
7+
}
8+
9+
if [ -z "$1" ]; then
10+
echo "Usage: $0 \"blog post title\""
11+
exit 1
12+
fi
13+
14+
export date_str="$(date +%F)"
15+
export slug="$(slugify "$1")"
16+
cat << EOF > "content/blog/${date_str}-$slug.md"
17+
+++
18+
title = "$1"
19+
date = "${date_str}"
20+
draft = true
21+
+++
22+
23+
wip
24+
<!-- more -->
25+
EOF

0 commit comments

Comments
 (0)