You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
440 B
20 lines
440 B
3 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
file="$1"
|
||
|
|
||
|
getBlogSlug(){
|
||
|
echo "$1" | sed 's/^content\//\//' | sed 's/.md$/\//' | sed -E 's/[0-9]+-//'
|
||
|
}
|
||
|
|
||
|
info="$(sed -n '/---/,/---/p' "$file" | sed '/^$/,$d' | sed -n '1,/---/p' | sed '/^---$/d')"
|
||
|
|
||
|
slug=$(getBlogSlug "$file")
|
||
|
date="$(echo "$info" | yq -r .date)"
|
||
|
title="$(echo "$info" | yq -r .title)"
|
||
|
description="$(echo "$info" | yq -r .description)"
|
||
|
|
||
|
echo "=> $slug $title"
|
||
|
echo -e "\t$date"
|
||
|
echo "$description"
|
||
|
|