Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wordpress import ? #40

Closed
tmos opened this issue Sep 1, 2014 · 21 comments
Closed

wordpress import ? #40

tmos opened this issue Sep 1, 2014 · 21 comments
Labels

Comments

@tmos
Copy link

tmos commented Sep 1, 2014

Hi,
Is there a way to import wordpress content on Grav ?

I am very interested to switch from WP to this very nice CMS :)
Thanks for your time,
Regards
Tom

@rhukster
Copy link
Member

rhukster commented Sep 1, 2014

I'm afraid we don't currently have a wordpress import. Definitely something we will look at for the future though! Thanks for the feedback. 👍

@tmos
Copy link
Author

tmos commented Sep 1, 2014

OK thanks for the good new :)

@mahagr mahagr added bug and removed bug labels Sep 1, 2014
@tmos
Copy link
Author

tmos commented Sep 3, 2014

Hi,
I have found a way to do the export, it seems to work at this time. I just can't export pictures.

  • export your wordpress content with the built-in export feature (as xml so)
  • install this python script : https://github.com/dreikanter/wp2md
  • go to your export directory (I suggest to put in on an empty directory, as articles will appears here)
  • run this command : wp2md -d ./ export.xml -ps {title}/item.md.

The -ps allows you change the structure of the export. The structure here is made to fit the blog skeleton of Grav.

It appears .md files are not out-of-the-box okay for Grav. I continue my researches, and I tell you :)

@mahagr
Copy link
Member

mahagr commented Sep 3, 2014

Header is in wrong format, which prevents the files from working.

@tmos
Copy link
Author

tmos commented Sep 3, 2014

Yup, I'll try to do a little script, but I'm not very familiar with python.

@tmos
Copy link
Author

tmos commented Sep 6, 2014

I made a first try in bash : https://gist.github.com/tmos/6131ecd3a7a1d526341d
And it seems to work pretty well :) !

With this header from wp2md :  

title: Wikipedia VS Universalis
link: http://tomcanac.com/blog/2013/09/21/wikipedia-vs-universalis/
author: tomcanac
description: 
post_id: 1384
created: 2013/09/21 15:20:24
created_gmt: 2013/09/21 14:20:24
comment_status: open
post_name: wikipedia-vs-universalis
status: publish
post_type: post

I have this :

---
title: Wikipedia VS Universalis
date: 2013/09/21 15:20:24

taxonomy: 
 category: blog 
---

And the import seems to be okay on my dev install. If anybody can confirm, it could be great :)

@rhukster
Copy link
Member

rhukster commented Sep 7, 2014

you could set a few more header options that you might find useful. For instance, that postname could be used to set the 'slug' on the grav page. Is there anyway to get the wordpress tags for this article? Would be nice to set those too. Nice work though!

@tmos
Copy link
Author

tmos commented Sep 7, 2014

Yes, the slug could be used to keep the same links on some sites (if permalinks were not modified).
The wp2md script doesn't export tags and/or catergories :( I asked to the creator, but he don't seems on the script anymore.

Well, this is not perfect, but works for a little migration.
I hope it can help some people :)

@petermolnar
Copy link

I did the following:
https://petermolnar.eu/linux-tech-coding/exporting-wordpress-to-a-grav-friendly-markdown-yaml-format/

The HTML to markdown is tricky, especially with definition lists and tables, full auto import might not entirely be possible.

@cord
Copy link

cord commented Apr 16, 2015

hey guys, am working on a wp plugin to export into a grav file structure. The export will support multilingual sites using qtranslate and qtranslate-slug

@cord
Copy link

cord commented Aug 25, 2015

Just released the wordpress plugin wp2grav to export pages, posts, authors, categories, tags into the grav format:

https://github.com/SiteBeez/wordpress-wp2grav-markdown-exporter

@simogeo
Copy link

simogeo commented Aug 25, 2015

I'll test it soon ! Thanks for sharing !
Does it handle images ?

@cord
Copy link

cord commented Aug 26, 2015

@simogeo just updated the documentation regarding images and link.

Also submitted to
https://wordpress.org/plugins/wp2grav/

(lets see if it gets approved...)

@simogeo
Copy link

simogeo commented Aug 26, 2015

I tested your plugin. It works well ! great job

@cord
Copy link

cord commented Aug 26, 2015

great! feel free to improve the code if you see any need

@mahagr
Copy link
Member

mahagr commented Sep 7, 2015

I believe this one can now be closed. :)

@jeffmcneill
Copy link

The plugin was removed from the wordpress.org plugin site.

@Kuzmanov
Copy link

@jeffmcneill You can find the plugin here: https://github.com/SiteBeez/wordpress-wp2grav-markdown-exporter, but from the reviews on WP.org it seems it's not working.

@jeffmcneill
Copy link

jeffmcneill commented Nov 29, 2018

Hi @Kuzmanov thanks for that. Are there any other options for doing migration from Wordpress? I see this plugin, but it looks like it only fetches, but does not store Wordpress posts. Also, I've got both posts and pages that need migration from a few different sites.

https://github.com/cpannwitz/grav-plugin-fetchwp

P.S., my content is already stored in Wordpress in Markdown (I use the markdown-extra plugin), so conversion from html is not needed.

@Kuzmanov
Copy link

@jeffmcneill No idea if there is a working plugin for migration, but I will definitely look into that and develop one :) FetchWP is not doing any migration.

Just an idea: You can export wp_posts in csv and create folder and post.md with the content using a shell script.

@jeffmcneill
Copy link

@Kuzmanov the tables are very messy. Export out to xml and then modify from there is the only sane approach I can see (which is what the previous plugin did). I'll take a look at the errors it is throwing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants