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 Export to Ghost initial version #621

Closed
ErisDS opened this issue Sep 3, 2013 · 43 comments
Closed

Wordpress Export to Ghost initial version #621

ErisDS opened this issue Sep 3, 2013 · 43 comments
Assignees
Milestone

Comments

@ErisDS
Copy link
Member

ErisDS commented Sep 3, 2013

One feature that everyone is clamouring at our heels for is the ability to move their data from an existing WordPress blog.

We have a shiny import feature, which needs a few tweaks to prevent duplication & to make sure tags work, but otherwise is working.

We should be able to write a plugin for WP which exports the data we support in exactly the format we need to use with our importer. This should provide the option to choose a single user to export, and then export all posts, tags, and any settings which are useful to us.

It would be great if the plugin also provided instructions on how to use the exported file with Ghost.

This is the initial version, because long term we'd like to provide this as a plugin for Ghost which reads the WXR format, rather than a plugin for WP, but we don't have all the pieces in place needed for that sort of plugin just yet.

@javorszky
Copy link
Contributor

I can take this on.

@ghost ghost assigned javorszky Sep 3, 2013
@ErisDS
Copy link
Member Author

ErisDS commented Sep 3, 2013

👍 I had a feeling you might say that 😀

@javorszky
Copy link
Contributor

😉

@JohnONolan
Copy link
Member

@javorszky you are now listed as a committer on http://plugins.svn.wordpress.org/ghost/

@javorszky
Copy link
Contributor

@JohnONolan, awesome, thank you. @ErisDS, I summon thee, for thee are needed for the questions below as well. :) (and everyone else who wants to chime in)

  • what to do with custom post types? (there's posts, but what if someone has news as well?) I'm thinking extra tags to specify post types?
  • what to do with shortcodes? I have a plugin that embeds github gists by writing [gist id="4146091"]. That will obviously not work on Ghost. I assume this should be part of the documentation of stuff that's known not to work?
  • what to do with inline images? The img tags will come across, but they will still point to the original server's wp-upload directory.
  • comments will also be lost, unless they already use disqus. However if they sign up for disqus before the export, they can then move their comments from wordpress to the disqus system. Not sure how the comments would be moved to Ghost though. (quick search resulted in http://help.disqus.com/customer/portal/articles/286778-migration-tools).

If I've left out something add it here, otherwise I'll start hacking my way around it.

@JohnONolan
Copy link
Member

I would say

  • Ignore custom post types. Better to just not support them at all. On that note - import all pages first (so they are posts in Ghost, but effectively the absolute oldest in the steam).
  • No idea
  • What if we rewrote all image urls to "/content/images/wp-upload/" and told WP users to download their wp-upload directory and upload it to the /ghost/content/images/ directory?
  • Good move - I like the idea of telling people to move their comments to disqus first.

@javorszky
Copy link
Contributor

WRG to pages, what about hierarchical pages? Like About Us / The team, About us / The service, etc...

@JohnONolan
Copy link
Member

Just strip the hierarchy - I reckon.

@javorszky
Copy link
Contributor

More questions:

  • Should I export users? Assuming the Ghost installation will already have a user installed, I do not think it is necessary, and all posts will be attributed to that user.
  • Same goes for roles?
  • And permissions?
  • And settings?
  • Tags and categories will be exported as tags.

@javorszky
Copy link
Contributor

Hah, importer doesn't have a concept of tags, so I'm not dealing with those.

@ErisDS
Copy link
Member Author

ErisDS commented Sep 14, 2013

The importer for this isn't written yet, I'm working on it in #734 and it will have a concept of tags.

Do posts & tags to start with.

Then if there is time, export as much data as possible - that way people have their data saved. In the future, the importer can read more of the data and deal with it.

@javorszky
Copy link
Contributor

So I can decide on the exported format, and whoever's doing the importer will conform to that?

@ErisDS
Copy link
Member Author

ErisDS commented Sep 14, 2013

The idea is to make it work with one of Ghosts standard importer. However

  • the standard importer needs updating to work with the new data model which will land in master at some point this afternoon, I'm working on this
  • the new standard importer will work roughly the same way as the old one, attempting to deal with tables and map them to models
  • the export can have more data in it than the importer understands, the importer will just ignore it.

Therefore, if you export WordPress data to look roughly like a normal Ghost export but with extra stuff in it, all should be fine.

@nicoburns
Copy link
Contributor

Wouldn't someone running a ghost blog most likely want to replace WordPress pages with static HTML pages outside of Ghost? In which case it would make more sense not to import them at all...

@javorszky
Copy link
Contributor

First pass at the plugin, download this file: https://www.dropbox.com/s/rrq2fegu4yb7vid/wordpress-2-ghost.zip, then go to plugins, add new, from zip file, upload it there, and then Plugins -> WordPress 2 Ghost, download the file, and try to import it to Ghost ( /ghost/debug/ ).

Currently:

  • ignores pages
  • ignores custom post types
  • exports all categories as tags
  • exports all tags
  • maintains the relationship between the posts and tags / categories
  • ignores shortcodes (it's just text)
  • ignores images (automatic download / rewrite is a tad harder)
  • ignores metadata
  • ignores comments

@JohnONolan
Copy link
Member

Kill the 500kb screenshot and placeholder banner assets for optimum load times :)

@javorszky
Copy link
Contributor

I also need to get rid of a few js files and whatnot, but functionality wise, does it work? :)

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

@JohnONolan
Copy link
Member

I think optimal menu item would be "Export to Ghost" under the "Tools" section.

@JohnONolan
Copy link
Member

First run import:

Error importing data: SQLITE_CONSTRAINT: column slug is not unique

@javorszky
Copy link
Contributor

wee... right, knee-deep! Worken. :)

@JohnONolan
Copy link
Member

Here's my file too http://cl.ly/RRn2

@javorszky
Copy link
Contributor

woo, sorting the slug issue. Also, here's to handling REALLY LARGE files. Both of yours are more than half a meg of pure text. Awesomeness :)

@javorszky
Copy link
Contributor

Right, here's a newer version: https://www.dropbox.com/s/5z3ynm8jd2paqzd/wordpress-2-ghost-6.zip

I was able to import Hannah's feed in no problem. Also tested with a client site with 270 posts (file size 3.4 mb).

@JohnONolan, your file failed to import because it's cut in half. As if fwrite didn't finish whatever it was doing, and I have no idea how to even begin to debug that. What's the php version on the server your WP install is on?

My other idea is that for some reason the header isn't getting the correct filesize value, and thus browser cuts off transmission halfway through...

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

We should probably come up with some sensible content? Maybe a nice Ghost logo? @JohnONolan

image

@javorszky
Copy link
Contributor

Content is going to be added later (when I get home). Stuff like:

  • what aren't supported yet (images, shortcode, etc)
  • what are supported (tags, categories as tags kept)
  • what is going to happen exactly (download a file)
  • what to do once in Ghost (fire up Ghost, log in, navigate to... etc...)

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

How do we feel about recommending users use something like http://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/faq/ before exporting to ensure they keep their images?

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

Also, as per IRC: please can we swap the order the posts are exported so that they get updated_at timestamps in the same order as published_at? Thanks!

@JohnONolan
Copy link
Member

Good - provided it's simple to use.

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

Thoughts on shortcodes

This is just me thinking aloud about what to do with shortcodes. We don't really have a way to handle them right now. But there are two types.

1. Ones which are built into WP. You might not even realised you used one:

shortcode

2. Custom ones

custom shortcode

Is there a way we can detect what shortcodes are present on a WP install? Maybe map them to some html?

This is all long term stuff, we probably need a WP-specific importer which post-processes the WP markup and does something sensible with these.

@javorszky
Copy link
Contributor

Yup, I can totally export the entire regex for all the shortcodes, ever. And import that into Ghost. And possibly create a Ghost.Shortcodes object while I'm at it.

@javorszky
Copy link
Contributor

The problem though is grabbing the content of the functions in php, which would pretty much be a case of... nope. Because of the differences between the two languages, I can't reproduce the exact behaviour, unless I manually rewrite them in js.

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

I wasn't suggesting we reproduce them in any way.

This is seriously future stuff but for all the WP ones have some standard transformation [caption] -> <figcaption> [gallery] - > null etc

Then for each of the custom ones, provide a form where they can be mapped so in my case
[cc*] -> <code>
[/cc] -> </code>

It wouldn't be a perfect reproduction, it's more about not having shortcodes in the posts any more.

@javorszky
Copy link
Contributor

Oh, that shouldn't be a problem. Regex and I have an ... understanding that we developed over the years. :)

@ErisDS
Copy link
Member Author

ErisDS commented Sep 18, 2013

Oooooh my vimeo embed imported properly :D

@javorszky
Copy link
Contributor

Righty-o. I've written some text. There's css styling missing badly from that page, but I think the content is okay unless y'all have legal / stylistic suggestions to it.

Grab it here: https://www.dropbox.com/s/cf5avz6p3o56eec/wordpress-2-ghost-9.zip

@javorszky
Copy link
Contributor

By the way: text is in views/admin.php, css is in css/admin.css, and you would probably need to enable that in class-ghost.php:98.

@JohnONolan
Copy link
Member

@link is currently pointing to javorszky.co.uk - would you mind pointing that to ghost.org?

Cheers

John

On Wednesday, 18 September 2013 at 19:23, Gabor Javorszky wrote:

By the way: text is in views/admin.php, css is in css/admin.css, and you would probably need to enable that in class-ghost.php:98.


Reply to this email directly or view it on GitHub (#621 (comment)).

@javorszky
Copy link
Contributor

Sure, replacing file in a few mins...

@javorszky
Copy link
Contributor

Updated comment with the link with the correct legal meta-info :).

@javorszky
Copy link
Contributor

Leaving a mental note for future me tomorrow:
[20:41:33] HannahWolfe: if you want hints about styling
[20:41:34] HannahWolfe: http://my-ghost-blog.com/
[20:41:38] HannahWolfe: ^ follows our branding
[20:41:41] javorszky: coolio
[20:41:49] HannahWolfe: so does http://docs.ghost.org/

@javorszky
Copy link
Contributor

Can be closed because: http://wordpress.org/plugins/ghost/ :)

@JohnONolan
Copy link
Member

:)

jgerulskis pushed a commit to samhatem/clear-ghost that referenced this issue Mar 18, 2020
* Changed {{code}} to {{statusCode}}

refs TryGhost/gscan@2ebd9fe

- {{code}} use has been deprecated in canary rule set of gscan

* V3 Update

* Update package and readme for 3.0

* Improve install instructions

* Update to support browserlist

* Upgrade dependencies

* Fix misnamed property

* V3 darkmode (TryGhost#619)

Added dark mode styles

* Casper final  refinements batch 1

* Casper final  refinements batch 2

* Fixed bookmark card hover bug

* Fixed header social links

* Updated screenshots

* Updated readme

no issue

- refreshed screenshot

* Udpate screenshot in readme

no issue

* 3.0.0-beta.2

* Fixed cut header for post cards

no issue

* 3.0.0-beta.3

* 3.0.0-beta.4

* Updated current version and previous version logic (TryGhost#554)

no issue

- Use current version from `package.json` instead of `npm_package_version` env variable
- Use `release.tag_name` instead of `release.name` for previous version

* Updated jQuery to 3.4.1 to avoid known vulnerabilities (TryGhost#590)

no issue

https://snyk.io/vuln/npm:jquery?lh=3.2.1&utm_source=lighthouse&utm_medium=ref&utm_campaign=audit

* Fixed code cards with long lines from being too wide

no issue

Credits - TryGhost/Casper#602

* Bumped gscan version to v3.0.0 (TryGhost#621)

* Bumped gscan to v3.0.0

- This also fixes failing CI builds because the default rules that are being checked were for v2

* Added explicit version check for gscan command

* Added member subscription support (TryGhost#623)

* Added member subscription support

no issue

* Added member subscription success message

no issue

* Added member subscription overlay

* Refined members subscription overlay

* Deleted unused website icon

* Ran CSSComb

* Updated built assets

* 3.0.0-beta.5

* Updated built assets for v3

no issue

* 3.0.0-beta.6

* Remove unused partial

* V3 cleanup (TryGhost#625)

* Removed unused infinity icon

* Removed unused location icon

* Removed unused 'point' icon

* Removed unused Ghost logo icon

* Removed unused author partials

* Cleaned up index log

* Fixed responsive feature image sizes for page template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants