Redirects

Micro.blog can redirect some common URLs for you, and has the option to create additional redirects using pages. Micro.blog will automatically handle the following redirects:

  • To help migrate from another blog, Micro.blog will redirect any missing file ending in .xml to your default feed. It will also redirect WordPress-style feed URLs such as /feed.
  • When importing from WordPress, Tumblr, or Ghost, Micro.blog will keep track of the original URLs used. Micro.blog will automatically redirect these URLs to the new URLs on Micro.blog. (Your custom domain name must be the same for this to work.)

If you need to add more redirects, you can create a new page on your site: Posts → Pages → New Page. In the text contents, enter the full URL to redirect to:

After creating the page, you can edit it to change the path for the URL from the default. Click on the page and look for the “Edit” button in the corner:

Screenshot of Edit button

I love the idea of putting the redirected URL in the page text box and Micro.blog handling the rest. Right now, the page opens with the title, pauses, and then pushes the redirect. I could see the pause as being confusing to some visitors.

Are there any plans to speed up the redirect on M.b pages to a more .htacess-like experience?

Yes, the “visibility” of the redirect bugs me as well, and it’s worse in some themes. I’d like to make it a true server redirect so that it’s more seamless.

2 Likes

I came across the template location for the generated page that flashes somewhere in the Hugo documentation. One assumes it would be as simple as overriding that template without the h1 page title header.

I currently have it the other way. Zero generated page at https://moondeer.blog/music but categories gets back into the url. Noticed this by adding content/categories/music/_index.md (for this example) so I could get per category page descriptions. Decided I may as well toss in an alias.

Update: this was the documentation I was thinking of

Update 2: dropping this in my theme as layouts/alias.html squashed the flicker for a test page and category I set up, but it also squashed whatever you had working to keep the shortened URL, perhaps you’ll know what to do with it.

<html>
    <head>
       <title>{{ .Permalink }}</title>
       <link rel="canonical" href="{{ .Permalink }}">
       <meta name="robots" content="noindex">
       <meta charset="utf-8" />
       <meta http-equiv="refresh" content="0; url={{ .Permalink }}" />
    </head>
</html>

Update 3: Totally solved the issue for me, someone will have to point out how many best practices I have broken. Already having ALL my categories properly aliased as I describe above, dropping this in the footer completes the package.

var href = window.location.href;

if (href.includes("/categories")) {
  href = href.replace("/categories", "");
  history.pushState({}, "", href);   
}
</script>

Thanks for sharing that @Moondeer! Looks like a clever solution and hopefully others will find it helpful too. (I still plan to improve redirects later, but that shouldn’t interfere with this.)

1 Like