URL import mapping

Hello,

I’m looking into importing 200+ posts via a zip upload of text files, and it looks like the URL structure for posts on Micro.blog is /YEAR/MONTH/DAY/SLUG.html (where SLUG is the first 3 words of the title, separated by an hyphen).

My current blog (not Micro.blog) is /YEAR/MONTH/DAY/TITLE (where Title is the words of the title, separated by hyphens).

Is there a simple way to create redirects automatically for all 200+ posts? Something redirecting /YEAR/MONTH/DAY/TITLE to /YEAR/MONTH/DAY/SLUG.html?

If I have to redirect all post individually, it kinda ruins the benefits of the import feature. Maybe i’m missing something!

Some of the import formats (like WordPress and Tumblr) automatically create redirects for the old URLs, but the Markdown folder .zip import does not yet. The good news is that I’m working on adding this right now and hope to have it rolled out later this week. If you can wait a few days to run the import, the experience will be better. Or you can import it now and then import again later and it will update the redirects without creating new posts.

1 Like

That is absolutely brilliant. Perfect timing! Thank you very much! I can definitely wait, no problem.

I’ve updated the Markdown import now. Make sure you enter a domain name when choosing the file to import, because Micro.blog uses that to match up the incoming URLs to redirect. In the front matter, Micro.blog looks for either “permalink” or “url” fields. They can be a full URL or start with “/” and the domain name entered will be used.

If something doesn’t work, check Account → Logs and then email help.

1 Like

Thank you!

So, if I understand correctly, the text files that are imported need to have the “permalink” and/or “url” fields in them for the redirection to work, right? What happens if they don’t have that field?

My 200+ text files almost don’t contain this field, except for a few fancy permalinks (that don’t start with /): my text files only contain the content, tags/category, and date.

I will try again by adding a few of them manually to see if I have understood correctly.

Thanks again!

That’s correct. Micro.blog needs some hint of what the original URLs were at the previous site. If you have a minute, feel free to email me a copy of some of your Markdown files to help@micro.blog because it may help us improve the import in the future to support more fields.

1 Like

Well, sorry, it’s me again.

I’ve tried to add the permalink field to a dozen posts before reimporting them to see if I understood correctly how this works, but I could not figure out what I am doing wrong since the redirects are inexistent.

The files have a “Permalink:” field, and either the full URL of the post, or starting after the domain ("/slug"), which I have entered before importing.

When visiting the former URL, and changing the domain name to my Micro.blog’s site, I get a 404, even after waiting 20 minutes and rebuilding the site. Am I missing something?

In the end it is not a big deal, I can slowly redirect manually all the URLs, but if this works, then I want to benefit from it :slight_smile:

Thanks again, and sorry for the repeated messages.

I checked your site and it doesn’t appear that the URL is being picked up. I need to add a place in Micro.blog so that you can view the redirect URLs since it’s admittedly hard to debug right now. Your understanding of how it should work is correct, but something still isn’t quite right… I think we should probably take this to email to resolve it.

Oh, quick follow-up… Just noticed what the problem is, and I think I’ve now fixed it in Micro.blog. Give the import a try again and let us know if it works.

1 Like

Hello again, thanks for your great assistance.

Sadly, no, it doesn’t appear to work. Or maybe the 404 redirects is prioritised over the other ones? I’ve added a few “manual” redirections in the Pages page, and these work properly, but not when importing content via the Zip file. Maybe I’m doing something wrong? (wondering for instance if I should put the URL “myurl.com” or “https://myurl.com”; if the “permalink” field has to be first in the file, or if it can be under the date, etc.)

I will try again later after removing all posts and reimporting everything again. Happy to follow up by email if needed: this import thing is the last thing that I couldn’t figure out on Micro.blog. Anyway, thank you.