Creating Pelican Markdown Files

I have had a bash function to create new wiki entries for quite some time. I have been meaning to do the same for my blog but it was one more thing on the list. I finally got around to it.

First, ensure that the directory structure I want is created. Then create a markdown file pre-populated with the markdown structure Pelican needs for each post. I can just run the function on any Pelican blog and it will create a file for me.

I think that these new automation's I have added will help me post more often.

I need to figure out how to copy the file path to the clipboard still but other then that it seems to work well.

I also am curious if there is a way to execute this function directly from vscodium. UPDATE: vscodium has shell integration CTRL+`, this open's a shell in the CWD.

blog_entry ()
    if [[ -f $1/ ]]; then
        BLOG_PATH="$(realpath $1)/content";
        echo "Provide A Pelican Blog";
    read -r YEAR MONTH DAY <<< $(date "+%Y %m %d");
    if [ ! -d $ENTRY_PATH ]; then
        echo "$ENTRY_PATH Not Found: Creating";
        mkdir -p -p $ENTRY_PATH;
    read -p "Enter title: " TITLE;
    read -p "Category: " CATEGORY;
    SLUG=$(tr [:upper:] [:lower:] <<< "$TITLE");
    SLUG=$(tr ' ' '-' <<< "$SLUG");
    if [ -e "$OUTPUT_FILE" ]; then
        printf "file already exists: exiting\n";
        return 100;
    DATE=$(date "+%F %R");
    MD_META="Title: %s\nSlug: %s\nDate: %s\nAuthor: %s\nCategory: %s\nTags:\nSummary:\nStatus: draft\n";
    printf "Created markdown file:\n%s\n" "$OUTPUT_FILE"