How to import the exported .zip file to Hugo

I am trying to export a small local wordpress site of 20 posts. I have hugo-export.zip file created using the Export to Hugo plugin and I also have jekyll-export.zip as a second option created using the jekyll exporter plugin. Both the files are placed in ~/Dev/Hugo/testimport/

I have also created a local site on my local hugo system named ‘testimport’ where the site will be imported into.

What commands do I use to import the .zip files? I am seeing https://gohugo.io/commands/hugo_import_jekyll/ and https://gohugo.io/commands/hugo_import/ but I am bad at this stuff and could use a little hand holding.

Thank you.

I never used these tools but I think that first of all you need to expand the exported ZIP manually.
Take note of the expanded ZIP’s directory PATH.
Then make an empty directory for your Hugo site and again take note of its PATH.
And then run the commands as stated in the Docs.

e.g. hugo import jekyll expanded_ZIP_path Hugo_dir_target_path

Try that and see what happens.

Hello, thanks for the quick reply.

When I try to expand the ZIP manually, I get an error saying could not load the archive for both the ZIP files.

What are you using? If on Windows use 7zip instead of what’s bundled with Windows. If on UNIX use the appropriate command.

If the above fails then your ZIP is corrupt.

I am on Linux Mint. I am using the standard ZIP archive manager that comes pre-installed with Linux. I think the ZIP files are corrupt most likely. Also both the ZIP files exported are under 250 bytes in size.

As for the local Wordpress, I am using XAMPP and the site is pretty clean and minimal with just 2 plugins and 2 themes and absolutely clutter free otherwise.

I have never used Wordpress, except for migrating a project to Hugo but that was some time ago and I ended up doing most of the migration manually.

Maybe someone else will help you.

Those sound like they are incomplete files.

Hey, you might just copy and paste the 20 pages over. It will probably be easier than importing and then fixing up the pages.

Anyhow, your next step is to get one of those import plugins working on your site. The zip files should not be very large, and should open immediately. Good luck!

Yes they are incomplete and most likely empty. I have no clue why both the plugins exported an empty zip and have no clue on how to fix it either.

As for copy pasting the 20 pages, the problem is each post has about 50 images and I cannot manually edit each one nor can I bulk search and replace because the code before and after as each URL is different. I also might have to create an image folder for each post to keep things organized. Also I would have to edit the internal links between posts so that would be tedious.

So my options are I will have to make the exports work or proceed with Wordpress which I am not too fond of

I may be off the mark here, but I don’t think those exports were going to do what you wanted anyhow. They are fairly primitive in importing with the files, if at all.

Anyhow, I’d try it with one page, see how it goes. Since they all probably point to something like /wp-content/uploads/20xx/xx/example.jpg, I’d just move the entire uploads directory into static/wp-content/ in your site project.

This has been another hacky tip to migrate WordPress to Hugo! :comet:

I may be off the mark here, but I don’t think those exports were going to do what you wanted anyhow. They are fairly primitive in importing with the files, if at all.

Anyhow, I’d try it with one page, see how it goes. Since they all probably point to something like /wp-content/uploads/20xx/xx/example.jpg , I’d just move the entire uploads directory into static/wp-content/ in your site project.

This has been another hacky tip to migrate WordPress to Hugo! !

Yes but moving the uploads folder is not the problem. If I do things manually,there are about 20 posts and each have 40-50 pictures and 4-5 outgoing links.

Each image looks something like this

img class=“aligncenter size-large wp-image-417” src=“http://localhost/sitename/wp-content/uploads/2018/08/sunset-image-1-1024x683.jpg” alt=“” width=“910” height=“607” />

Each hyperlink looks like

a href=“http://localhost/sitename/sunset-images/”>my sunset pictures

This means there are roughly 1000 images and 100 links. I cannot change each manually by hand. How do I edit the links?

Sorry, from your description I can’t imagine the site. If you can link to it I’ll take a look. Otherwise, you might consider hiring someone to help with the migration. I think you can post to #services. :slight_smile: