Adding music shelf
This commit is contained in:
parent
c2af88d118
commit
bdd00ec9e8
18 changed files with 394 additions and 110 deletions
38
new.sh
Executable file
38
new.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to create new Hugo content w/ filename sanitization
|
||||
# Usage: ./new.sh <type> <title>
|
||||
|
||||
set -e
|
||||
|
||||
# Check if required arguments are provided
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: $0 <type> <title>"
|
||||
echo "Example: $0 blog 'My Awesome Post'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TYPE="$1"
|
||||
shift
|
||||
TITLE="$*"
|
||||
|
||||
SAFE_TITLE=$(echo "$TITLE" | \
|
||||
tr '[:upper:]' '[:lower:]' | \
|
||||
sed 's/ /-/g' | \
|
||||
sed 's/\//-/g' | \
|
||||
sed 's/[^a-z0-9_-]//g' | \
|
||||
sed 's/-\+/-/g' | \
|
||||
sed 's/^-//;s/-$//')
|
||||
|
||||
# Construct the filename with date
|
||||
FILENAME="${SAFE_TITLE}/"
|
||||
|
||||
# Construct the full path
|
||||
CONTENT_PATH="${TYPE}/${FILENAME}"
|
||||
|
||||
# Create the content using hugo
|
||||
echo "Creating new content: content/${CONTENT_PATH}"
|
||||
hugo new "${CONTENT_PATH}"
|
||||
|
||||
echo "Content created successfully!"
|
||||
echo "File: ${CONTENT_PATH}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue