Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to export and rehost your Tumblr site

How to export and rehost your Tumblr site

(Update: Version 3.2.0 of Jekyll looks like it's breaking a few things, so I've changed the guide to make you specifically install the version I was using, 3.1.3. I believe this is the issue: jekyll/jekyll#5145.)

You will be using jekyll-import to export your Tumblr site, Jekyll to (re)create it, and Surge to rehost it.

Update: You can also use Tumblr's native export feature in your blogs' individual settings. But rehosting that might be tricky. Read my comments below this post for how that works.

Setup and installation

You will need:

  • Ruby installation
  • Node installation
  • Knowledge of how to use the terminal

This guide is not optimized for Windows, because I can never get Ruby to work on the damn thing.

In your terminal, type:

gem install jekyll -v 3.1.3
gem install jekyll-import
npm install --global surge # For hosting

myblow below is a placeholder; use your Tumblr blog name instead

mkdir tumblr 
cd tumblr
jekyll new myblog
cd myblog
touch myblog.rb

Exporting your Tumblr site

Open myblog.rb and enter this:

require "jekyll-import";

JekyllImport::Importers::Tumblr.run({
    "url"            => "https://myblog.tumblr.com",
    "format"         => "html", # "md" misses links and images etc
    "grab_images"    => true,
    "add_highlights" => false,
    "rewrite_urls"   => false # `true` breaks build
})

If this returns an error, it's possible you may need to replace the "https" with "http".

Update: Also, take Jenn's advice in the comment below:

there were two errors i'd encounter - first the https vs http one you mentioned. another one was sometimes the images couldn't be accessed so script would stop. when this happened, i'd go to that post on tumblr and mark it as "private" and tried again and then it worked because the post was skipped. i had about 5500 posts and this error only happened 5 times.

Run the file to export your blog:

ruby myblog.rb

This will export your site into two folders: _posts/ and tumblr_files/.

Creating your own site

Now use the exported data to build your own blog using Jekyll:

jekyll build

I recommend you take a minute to review the file _config.yml in your text editor. It should look like this:

# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely need to edit after that.
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'jekyll serve'. If you change this file, please restart the server process.

# Site settings
title: Your awesome title
email: your-email@domain.com
description: > # this means to ignore newlines until "baseurl:"
  Write an awesome description for your new site here. You can edit this
  line in _config.yml. It will appear in your document head meta (for
  Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
github_username:  jekyll

# Build settings
markdown: kramdown

If you don't plan on defining a Twitter and GitHub username as well as an e-mail address, I recommend you just delete those lines, since the defaults will be featured on your site otherwise.

These are the required parts:

title: Your awesome title
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://yourdomain.com" # the base hostname & protocol for your site

# Build settings
markdown: kramdown

Hosting your site

Time to host the built site (in the folder _site/) with Surge

surge --project _site/

You will be asked to create an account with e-mail and password.

The site will now be hosted at <random>.surge.sh; if you want a custom domain, I recommend you read Surge's guide on custom domains, since it assumes some technical proficiency on your end.

Updating your site

To view your site locally, you can run jekyll serve. It's now viewable at localhost:4000, if you enter it into your address bar.

To build it with any new changes, run jekyll build.

To view your site locally and automatically update it when you make changes, run jekyll serve --watch. Note that this doesn't work for updating _config.yml, so you will have to end the running process and re-run it for the changes to carry through.

When your site has been built with the new changes, you can upload the changes with surge --project _site/.

Customizing your site

Clearly, the default design is so-so, but if you feel like experimenting, you can try some of the available themes at the sites below:

I've got zero experience with any of the sites, and all appear to have an awful ease of use---after all, the three main draws of Tumblr are its CMS, its themes, and its Dashboard, none of which are available here.

If you do try your hand at customizing your site, just remember to keep your _posts/ and tumblr_files/ folders and their content intact. If you mess up, you can always re-export your Tumblr site while it's still available.

HOWEVER! It looks like a dedicated theme feature is forthcoming, albeit indeterminately.


Hit me up on Twitter: @pessimism.

@jennschiffer

This comment has been minimized.

Copy link

jennschiffer commented May 15, 2018

thank you so much, this is great and worked awesomely. there were two errors i'd encounter - first the https vs http one you mentioned. another one was sometimes the images couldn't be accessed so script would stop. when this happened, i'd go to that post on tumblr and mark it as "private" and tried again and then it worked because the post was skipped. i had about 5500 posts and this error only happened 5 times. anyway, thank you so much for writing this up!!

@ndarville

This comment has been minimized.

Copy link
Owner Author

ndarville commented Nov 20, 2018

@jennschiffer Just saw your comment following the latest shake-up, appreciate the kind words and helpful feedback for others!

@ndarville

This comment has been minimized.

Copy link
Owner Author

ndarville commented Dec 3, 2018

Apparently there’s a native export tool I missed as well; go to the bottom of https://www.tumblr.com/settings/blog/yourblogname (per-blog settings) and hit the export button.

It takes a while to process ... In fact I’m still waiting for it to finish processing. Will report back when and if it finishes.


It seems to run in the background so at least you can close the tab.


https://tumblr.zendesk.com/hc/en-us/articles/360005118894-Export-your-blog


I just got up the day after starting the export, and it’s still running.


After about a day, the export is finally available for download. While you can download your exported data, it’s still not straightforward to re-host your blog, and you’ll have to set up a CMS separately. BUT, you do get an archive of your messages (in XML) which means a lot to many.

@MatthewDarling

This comment has been minimized.

Copy link

MatthewDarling commented Dec 5, 2018

Do you see actual message contents in the message XML? A couple months ago I did an export through some kind of "Oath data manager" page, and the XML files just tracked metadata like login times.

If you could paste an example message format, that would set my mind at ease :)

@ndarville

This comment has been minimized.

Copy link
Owner Author

ndarville commented Dec 6, 2018

@MatthewDarling Sure, here ya go:

<?xml version="1.0" encoding="UTF-8"?>
<tumblr version="1.0">
    <conversations>
        <conversation status="ACTIVE">
            <participants>
                <participant avatar_url="https://66.media.tumblr.com/avatar_d171e5232964_64.pnj">essays</participant>
                <participant avatar_url="...">...</participant>
            </participants>
            <messages>
                <message participant="t:..." ts="..." type="TEXT">hi do u write essays</message>
                <message participant="t:..." ts="..." type="TEXT">on occasion</message>
                <message participant="t:..." ts="..." type="TEXT">want to write me an essay</message>
                <message participant="t:..." ts="..." type="TEXT">you would really save my life</message>
            </messages>
        </conversation> <!-- ... ->

I’ll try to upload the full file structure for the export .zip when I’m on my MacBook.

@MatthewDarling

This comment has been minimized.

Copy link

MatthewDarling commented Dec 10, 2018

Their export queue has gotten a bit longer, but I got mine yesterday - and indeed, messages are included in a reasonable XML format. Woo! And there's individual .html files for each post, including drafts. It includes stuff from the older "inbox"/"fan mail" feature, too.

As you say, definitely harder to make a new blog out of this, but maybe new tools will pop up that work with the official export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment