Display a scheduled Hugo posts using shell-script.

Create simple schedule.sh shell-script.

#!/bin/bash
# Display scheduled posts and available publishing dates for n months

# define number of months
if [ "$1" != "" ]; then
  months="$1"
else
  months=1
fi

start_date="$(date +%Y-%m-%d)"
end_date="$(date +%Y-%m-%d -d "$start_date + $months months")"

date=$start_date
while [ "$date" != "$end_date" ]; do
  day=$(date +%a -d $date)
  interesting_day=0

  year="$(date +%Y -d "$date")"
  path="content/posts/${year}/" # content path
  scheduled_posts="$(ls "$path")"

  if [ "$day" == "Mon" ] || [ "$day" == "Wed" ] || [ "$day" == "Fri" ]; then # publishing days
    interesting_day=1
  fi
 
  if echo "$scheduled_posts" | grep -q "^$date"; then # non-publishing days
    interesting_day=1
  fi

  if [ "$interesting_day" -eq 1 ]; then  
    echo
    echo "$date $day"

    echo "$scheduled_posts" | grep ^"$date" | xargs -I {} grep ^title: "${path}/{}" | awk -F ": " '{print "  " $2}'
  fi
  
  date="$(date +%Y-%m-%d -d "${date} + 1 day")"
done

Sample usage.

$ bash schedule.sh
2022-12-05 Mon
  How to extract and parse LXD instance information

2022-12-07 Wed
  How to execute Varnish Test Cases

2022-12-09 Fri
  How to create directory with defined ownership and permissions

2022-12-10 Sat
  How to display every modified file in git repository

2022-12-12 Mon
  How to display hardware information the easy way

2022-12-14 Wed
  How to determine recommended NVIDIA driver

2022-12-16 Fri
  How to query and alter JSON documents

2022-12-19 Mon
  How to determine when LXD instance started

2022-12-20 Tue
  How to use HAProxy to redirect connection to active Vault cluster

2022-12-21 Wed
  How to display NVIDIA devices using command-line

2022-12-23 Fri
  How to force curl to use HTTPS protocol

2022-12-26 Mon
  How to generate new vault root token

2022-12-28 Wed
  How to lock OpenSSH authentication agent

2022-12-30 Fri
  How to inspect firmware update using RACADM command-line utility

2023-01-01 Sun
  How to enable HashiCorp Vault audit logs

2023-01-02 Mon
  How to generate new vault keys