DEV Community

Cover image for Refactoring your blog urls
Waylon Walker
Waylon Walker

Posted on • Originally published at waylonwalker.com on

1 1

Refactoring your blog urls

I just did a quick refactoring of my JAMStack blog urls. Some didn't fit with my style, some had _ that I wanted to switch to -, and others were rediculously long. I've been using forestry as my CMS, I write many of my posts there, and sometimes it picks some crazy file names (based on my titles). It was time to refactor.

🖊 Rename posts

change the filename

My post urls are based on the file name of my markdown file, so I can simply go through my filesystem and rename anything I want. From here its probably best to only commit the addition of the new file name, until the redirects clear, but these are all low traffic posts for me so I just commited both at once.

Safely redirect without breaking links

_redirects ⤴

/redirects

I am hosted on netlify, which automatically puts very ⚡ performant redirects on the edge based on a /_redirects route on your site. So I added a redirect from the old route to the new route there.

# rename long posts

/blog/i-finally-fixed-my-styled-components-in-gatsby-js /blog/fix-styled-components-in-gatsby
/blog/interrogate-is-a-pretty-awesome-brand-new-cli-for-python-packages /blog/interrogate
Enter fullscreen mode Exit fullscreen mode

pedantic 🤔

probably

This is probably being a bit pedantic. Realistically my urls were probably ok. These posts probably aren't going to be topping the google search charts anyways, but I wanted to do it without killing off any links that I may have happened to post somewhere.


👀 see an issue, edit this post on GitHub


I have been writing short snippets about my mentality breaking into the tech/data industry in my newsletter, 👇 check it out and lets get the conversation started.

Sign up for my Newsletter

Your next step

Do your career a favor. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay