Importing commento comments

Hello,

is there a way import commento comments into the new ghost comments feature. Is there a migration script or something like that?

Not that I am aware of. When moving over to Ghost comments (from commento) I have found that re-typing each of the previously made comments in commento is required. Interested to learn if there is an automated option for this.

There’s surely a better option than typing comments (at least, if you have a lot of comments). Unfortunately, the comments API doesn’t allow an admin to add comments as another user. (Or at least it didn’t, the last time I looked. Would love to be corrected on this.)

You could:
Scrape the old site (or copy paste) and add them statically at the end of each page in an HTML card. That’s pretty straightforward and retains the content.

Or you could do something more complicated. Read the commento comments (or an export?) to identify users. Create users for each of your commento commentors. Use the API (I think the staff owner API key is required to get an impersonation link?) to get an impersonation link and then a cookie for each user. Use the cookie to post the comments to each post, as each user. However, I suspect that won’t retain posting dates for the comments, as the comments API doesn’t take a created_at value under normal use…

Or you could write a script that does the comment insertion directly into the database, which would allow you to preserve the original commenting dates, but of course that requires database access, which isn’t available in some Ghost hosting options.

Hi Ghost’ers, I came across this thread while looking for information on how to migrate my Commento comments into Ghost. Not finding any information and with Ghost not having a comments import function yet, I managed to do this using SQL scripts.
My approach worked as I am self holding and so have access to database.
What I did was:

  1. Export the Commento “commeters” table as CSV
  2. Imported into Ghost members (small amount of editing).
  3. Copied the Commento comments table to “comments_migrate” table (PostgreSQL)
  4. Added denormalised data into the “comments_migrate” table (PostgreSQL)
  5. Dumped table and loaded into Ghost MySQL DB
  6. Generated Ghost IDs for the comments within comments_migrate table (MySQL)
  7. Used SQL joins to add GhostID based reference (MySQL)
  8. Turned off foreign key contraints and added data into the Ghost comments table
  9. Reabled foreign key contrainst

So quite a bit of SQL hacking… you can find SQL on GitHub via search.

Hope this is helpful and avoids “re-typing”.
Cheers from Oz,

Zebity.

3 Likes