Reorganize blog by year
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
|
@ -16,17 +16,19 @@ esac
|
|||
|
||||
SLUG="$1"
|
||||
TITLE="${2:-$SLUG}"
|
||||
DATE="$(date +%Y-%m-%d)"
|
||||
YYYY="$(date +%Y)"
|
||||
MM="$(date +%m)"
|
||||
DD="$(date +%d)"
|
||||
|
||||
slug=$(echo "$SLUG" | tr 'A-Z ' 'a-z-')
|
||||
dir="$DATE-$slug"
|
||||
index=$dir/index.md
|
||||
dir="$YYYY/$MM-$DD-$slug"
|
||||
index="$dir/index.md"
|
||||
|
||||
mkdir $dir
|
||||
cat <<EOD >$index
|
||||
mkdir -p "$dir"
|
||||
cat <<EOD >"$index"
|
||||
---
|
||||
title: $TITLE
|
||||
date: $DATE
|
||||
date: $YYYY-$MM-$DD
|
||||
tags:
|
||||
- untagged
|
||||
---
|
||||
|
|