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.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

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

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay