DEV Community

mafflerbach
mafflerbach

Posted on

Evolving my publishing workflow

After i published my first Article I decided to work on my workflow.
In this article i will expand my bash script.
I want to have all Article on one location but in different subdirectories. This directory is organized like this:

├── content
│   ├── drafts
│   │   └── Evolving my publishing workflow.md
│   ├── ideas
│   └── published
│       └── 20-10-2020 Create a new post via API.md
└── helper.sh
Enter fullscreen mode Exit fullscreen mode

In the drafts directory, i will have all my started article (hopefully only one file at the time).
In ideas, i will collect my articles which have only a title and contains some hints, notes or links for discovery.
In published i will collect all my published Article.

When i published my Article, the file will be moved from the draft directory to the published directory. I don't want to loose the publishing date of the article, so i want to add a date in front of the filename.

To achieve this i add the following lines in my bash script:

# escaping filenames with spaces for the mv command
filePath=$2
#get the current date
date=$(date +%m-%d-%Y)
# grap only the filename
fileName=$(echo "$filePath" | cut -d"/" -f3)
mv "$filePath" "$(pwd)/content/published/$date $fileName"

Enter fullscreen mode Exit fullscreen mode

In the next article i will take look on Front Matter and how to use this in the context of publishing on dev.to.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay