301 Redirection in Umbraco - It’s a Rum Do

Written by @marcemarc on Saturday, 13 January 2018

So silly things, although it’s easy to blame…

… And I’m going stupid once again, but I left it up to you.

Could these obscure ‘indie dance’ lyrics from the Paris Angel’s UK top 55 ‘hit’ in 1990 have been written specifically about the current situation for redirects in Umbraco?

No of course not, but it’s getting harder and harder for me to shoehorn a musical reference into my blog posts, and pick an appropriate youtube video to suit the subject matter or at least a bad pun of the blog post title, that well now, hmm, now, I’ve started picking the song first, and then I try to weave the blog post subject nonsense around the tune…

Let’s see how I get on, in theory there will be a series of posts about redirects here, reflecting the redirect related events in my life over the last three months, it seems like I nearly have enough for e-book.

But it is my New Year's Resolution to be more direct, and stop these whimsical digressions and observations, that make people forget what the original blog post was intended to be about by the time they reach the end of the article.

Let’s see how I get on.

Redirection Url Management

You may have noticed the introduction of the Redirection Url Management dashboard in Umbraco 7.5.x - (I accidentally had a hand in it, it sort of only exists (or at least the dashboard appeared in this version) because I was somehow invited to the Umbraco HQ retreat, and as a way of hiding during the 2nd day, I suggesting I’d be working on it, as we went around the group in the morning standup, as it sounded like a thing, even though it wasn’t a thing. http://issues.umbraco.org/issue/U4-8802 and it’s fun to see how very little of what I built made it into the actual dashboard… https://github.com/umbraco/Umbraco-CMS/commit/b4d5140d077c567e87423725e45cb0282d1c0b43#diff-1d1ef1a751b655e89ec108605bae6d65

but apparently the fact I had started it and work was in progress, was why it was polished up to squeeze into the release, every little helps, but maybe its genesis explains a little why the next question in your head is probably. 

Why can’t I manually add redirects ? 

The whole addition of the tracking was built as a minimum viable product in 48hrs, what was the smallest thing that could be built, and still make an improvement, for the single issue when the CMS knows a published url, has been changed, to issue a 301 redirect to the new url. The dashboard wasn’t part of that, the 301 redirects that get setup by this tracking of changes were going to be invisible… I figured that if Umbraco was going to start adding these redirects automagically, making them visible somehow to editors, would at least let people know what was going on…but mainly I’d have something to demo at the end of day two. 

Adding redirects for a mechanism that only tracks changes doesn’t makes sense, especially when the day is ending and people had already started to mix rum cocktails - That doesn’t mean there isn’t a real need to add that kind of mechanism to the core of Umbraco, it’s just it wasn’t addressed then, or kind of since. [Add link to Part 3 here] 

Ironically the presence and visibility of the dashboard, is the exact thing that places the thought in people’s mind ‘how do I add new things here?’ 

So where is this going?

Well, when I’m on my travels delivering sublime Umbraco Editor Training, or workshops helping Content and Developer teams work together to get the best out of Umbraco and at such reasonable rates too. I am fascinated by the tricks and workarounds that people who use a system everyday come to adopt, not because they’ve been told about them (often the reverse), but well, because they’ve discovered a way to bend the system to work for them, no harm done. 

And it feels good if you find a way, 'that works', that’s not supposed to… and it’s a secret. 

Like nudging in two identical fruits onto a win-line in a fruit machine, if the next spin you are offered to hold the reels - you don’t hold anything - let all the reels spin for a guaranteed win! It makes no sense, but it works and that feels good. 

So the content team at this company were told to email any redirects they wanted to set up to the developers via IT, who explained they needed a bit of notice to set them up, and they’d add them to a rewrite map in IIS, but nobody could really remember what had already been set-up, it wasn’t easy to manage. (and a duplicate entry caused a ysod - which triggered the crisis discussion). 

The redirects are content, editors need full control of them. 

When I was explaining about redirect options in Umbraco, one editor put his hand up and  said, 

“ahh, but if you rename a page in Umbraco to the redirect you want, and then name it back again, then switch to the Redirect Url Management tab, and remove the one from the list you don’t want, then you’ll see Umbraco has created a 301 redirect for you - let the reels spin and you are guaranteed a win!”...

 Have a look at what I am dubbing the rename-rename-remove redirect method, or rrrr for short.

.. .And next time I visited them, they were all doing it!

Life, uh, finds a way

(if I did giphys there would be a Jeff Goldblum one here right?, sorry to disappoint.)

The dashboard gave the visibility that enabled people to find a way, and people always will, find a way. And if they are doing this already, and you can’t stop them -  then it becomes an editor journey in the CMS, ...and you perhaps are familiar from earlier tales in this blog, I’m all about reducing editor journey times and making tasks simpler… responsibly. 

So I added a form to enable the editors to add redirects to the dashboard, but only to content in the cms that they could pick and only for relative Urls - so it was only a shortcut to repeating the ‘rename-rename-remove’ hack….

Here is the Rum Do version of the Redirect Url Management dashboard, same task:

A stopwatch task that had taken minutes to complete, and a bit of tomfoolery, was now down to under a minute, and it felt less arduous, less faff, especially for multiple redirects, it had removed the “do I really have to do this crazy thing, sigh” factor. 

But is that it?

not quite...remember the second question in the discussion?

What redirects have already been setup for this page?

With the current Redirect Url Management dashboard you can search for redirects that have been set up, that’s because it’s designed to let you find errant redirects and remove them, but it doesn’t let you search by the target page, it doesn’t answer the question, what redirects actually exist for this page?, and if you have a content item open, why would you switch to the dashboard to search... if we've learnt one thing during these posts, it's that 'context switching' has a big impact on mental agility and how 'quick' a task feels to accomplish... 

 ... so I added an action menu item - Manage Redirects, and now from within any content item in the content section you can click ‘Manage Redirects’ and a slidey-out panel will reveal a list of all the redirects from the Redirect Url Management dashboard for that particular page... without having to switch contexts...

...and then because at that stage I was a bit giddy with RUM (redirect url madness) I allowed the editors to create the redirects from the context of this slidey-out panel… 

... same task - the journey is even quicker.,. but more importantly, it feels more intuitive...

… this is wrong, I know this isn’t what the Redirect Url Management dashboard is supposed to be used for, the editors have been warned, there are better redirect strategies out there, but if you install them then that in turn disables the redirects already created on the Redirect Url Management dashboard… [Link to part 2]

It’s A Rum Do

I haven’t released this as a package, and I'm not sure whether it would be a helpful short-term addition to the core dashboard (it again is not trying to address the bigger picture of redirects in Umbraco)... what do people think?

...but in the meantime... should you work with editors who have mastered the ‘rename-rename-remove’ trick (rrrr), and you want to just let them do it easily...you can make use of this dashboard addition and slidey-out panel from the git repository here: 

https://github.com/marcemarc/tooorangey.RumDo