Two well used brooms stand upside down against a barn wall.

Cleaning Up Post Tags and Categories: Part Two

  • Adam Douglas

Well I’m at it again doing some clean up of the posts topics (categories), and tags. I spent some more time thinking about what I wanted, and I felt there was a little more room for some further cleaning. Before I got started I decided to review Kev Quirk’s, and Joel’s websites to gain some insight on how they organized content. Here is what I ended up doing in a little more detail than before.

Cleaning

I created a checklist for what I wanted to do for the topics, and tags as shown below. All these changes were done to all published posts as well as drafts. Shockingly I have 51 drafts as of this post.

Each topic would be moved or changed to another topic.

  • app to technology
  • hacking to technology
  • art to hobby
  • craft to hobby
  • website to web
  • cyberspace to LittleBits
  • household to hobby
  • hardware to technology
  • Unboxing to review
  • 1 post to review
  • 2 posts with app to adamsdesk

There wasn’t much for tags this time around.

  • bash to BASH
  • Remove ventoy

I began using grep, wc, and sed to help speed the process along. Combining grep along with wc helped get a total count of posts that would be modified, so I could confirm later that sed modified the same total of posts. Using git diff I reviewed the changes as I went along to ensure I wasn’t making any mistakes.

Here is an example of how I used grep, wc, and sed for the topic “app”.

grep -r "^category: app\$" _posts/ | wc -l
39
$ sed -i 's/category: app/category: technology/g' _posts/*.md

This is how I dealt with actually removing the entire tag, and line for “ventoy”.

$ grep -r "^    \- ventoy\$" _posts/
_posts/2021-02-09-ventoy-the-ultimate-multi-boot-manager.md
_posts/2021-02-14-how-to-create-a-multiboot-usb-with-ventoy-using-linux.md
$ sed -i '/^    - ventoy$/d' _posts/*.md

The only downside to all this was I had to change each post’s front matter for date modified, and change log manually. Unfortunately at the time of doing this I couldn’t see how I could automate those tasks since it wasn’t a simple removal or search, and replace. Some may think, and honestly I have too, why bother with the changelog? The main reason why I continue to do it is for accountability and history of changes of a post.

Stats

Here are the end results of a couple of hours of work. Not as a dramatic difference this time, but I feel better for doing it.

Item Name Before After Removed
Paginated pages 51 44 7
Topics (categories) 16 11 5
Tags 29 28 1

This is post 77 of 100, and is round 2 of the 100 Days To Offload challenge.

    • change 100DaysToOffload message