Icky slugs

Haste makes waste. I’ve been hearing that phrase forever, and each time I find myself using it, it seems to take on a whole new meaning.

I was eager to get this blog up and running – too eager perhaps, but there’s a lot to be said for unbridled enthusiasm. The problem is, I violated one of my own primary development rules – design before you build!

The concept for the website/blog was laid out simply enough. Until our design team had a break from working with our clients to design our own site, we would just make do with a WordPress blog. Easy to set up, easy to maintain, it just seemed like the right way to go – so I started to create some pages.

The problem with this was I didn’t think through all of the elements of presentation – how will the static pages relate to articles in the blog, and how will a blog work when the whole site is a blog. The consequence of this was having several iterations of the /blog page. There was /blog, but then that was replaced by /blog-2, then /blog-3 and so on. Frankly, it didn’t look very professional.

So I went about trying to research changing these “slug” names. Slugs in WordPress are the address portion of the page that follows your domain name – in our case, ardaramedia.com. WordPress likes slugs to be unique – which makes sense – two pages with the same name would be confusing for everyone. The tricky part is even when you delete a page, the WordPress engine remembers that slug name existed and won’t let you reuse it. For example, if you wanted to replace a page with one you’d created from a new page template, WordPress requires you give it a new and unique name.

I didn’t like that idea.

I wanted our blog to be ardaramedia.com/blog.

After hunting around the web for a simple solution, I was discouraged and ready to delete the site and start over. It was then I stumbled on the thought – if I’m going to delete the site, I should back it up first. WordPress has an Export function that lets you save your site to your desktop. WordPress also has an import facility to reload the site from this export. Maybe I could change whatever it was that held on to those old slug names!

Sure enough, it is possible. The export function creates an XML file. If you edit this XML file, you can delete items that you no longer use, and what WordPress has flagged as trash. I was lucky, I didn’t have any content on the pages I was deleting – so I just had at it. I deleted the 7 extraneous blog pages and was free to start that page process from scratch.

I wouldn’t recommend this for a newer user. It helped to have some background on the token structure of XML – but for those of you with a bit of a techy background, it’s absolutely possible!

Comments are closed.