I started using Discus then moved to Cove. I am happy with Cove and the support Dan has been offering.
However, one of the things I want to accomplish in 2023 is simplifying my application stack and reducing reliance on third-party services.
Is there a way to import comments … even if it’s not officially supported?
Hi Clay!
Are you asking if there is an unofficial tool that will automatically migrate comments from Cove to Ghost, or whether you’d be able to write a script to import them yourself? Along those lines, do you have access to the Ghost database?
@ryansechrest – I am guessing that if there were an official import tool it would have been announced.
Yes, I have access to the database. I personally would not write the script, the developer I retain would do it and then, I hope, offer it up for others to use.
I believe it would be possible to write a script, but there are a few caveats.
I’m looking at the comments
table in the database, which is where all of the comments are stored.
The fields that need to be populated for each comment are:
-
id
- ID of the comment, which is automatically generated for each comment
-
post_id
- ID of the blog post the comment belongs to
-
member_id
- ID of the member who posted the comment
-
parent_id
- ID of another comment if the comment is a reply to that comment
-
status
- Should be published
if the comment is live
-
html
- Contents of the comment with any HTML tags (paragraphs, etc)
-
created_at
- Date and time comment was created
-
updated_at
- Date and time comment was updated (would be same as created if never updated)
The caveats are:
- Can you export comments from Cove? If so, does each comment contain the ID of the Ghost blog post the comment belongs to? This is required in order to make the association between blog post and comment.
- There are no anonymous comments in Ghost, meaning before each comment is inserted, a corresponding member needs to be created in Ghost, and that member’s ID needs to be stored with the comment.
- To create a member, you’d need the comment author’s email and name from Cove.
- Ensure you have a free membership available on your Ghost blog so that each member can be assigned to that.
- If a comment is a reply to another comment, the parent comment needs to be inserted first, so that the parent ID is available to be stored with the reply comment.
Something else to think about is that because you’d be creating a new account for each commenter, they won’t be aware that an account is being created for them.
Along the lines of transparency, you may either want to reach out to those members for permission or let them know that you’ve migrated their comment, which resulted in them having an account created on your website.
That way, if they ever get a newsletter from the Ghost website or an email from you, it won’t be a surprise.
If I were writing a script, I would approach it as follows:
- Export all of the comments from Cove, and if possible, include the Ghost blog post ID with each comment.
- If I didn’t get the data in this format, I would try to figure out what in the export I could use to reliably associate a comment with an existing blog post in Ghost (maybe post title), and then extract the blog post ID in real-time during the import or build an index to be used by the importer.
- I would sort the Cove comment export by date, effectively ensuring that parent comments are imported first, so that any replies can look up the corresponding parent ID to keep that association. If you didn’t care about that, you could simply import all comments as top-level comments.
- Build a CSV file with all of the comment authors and import them into Ghost via the UI. Then, when comments are imported, you already know all members exist, and each member’s ID can be looked up with their email address.
Now, I haven’t imported or migrated anything into Ghost, so these are just my initial thoughts based on the limited information I have.
In summary, I think there is a way and I hope you succeed!
#ChocolateIsLife
2 Likes
Ryan – thanks for the thought and attention you put into this reply. I did not get back until now because the link to export the Cove comments file was temporarily unavailable.
Here”s the format of the export file (.CSV – so well ordered) followed by some example content:
ID – 891d4f6c-cb03-4e32-98a8-3009be46b9ef
Member ID – a5bbf144-83ce-4a84-9235-0f9fa29e925d
Member name {my name}
Member email {my email}
Visibility – visible / hidden
Parent ID – 2c425bf6-14a2-427a-9909-ca13ebfec693 (only on replies)
Date – 1609690548 (Julian)
Body {some text}
Topic Name {title of post}
Topic URL {URL of post}
All of the Cove commenters are subscribers to the site (memberships and free memberships are supported). Cove creates its local table using data from the Ghost install.
I can sort the CSV table so that everything is in date order – nothing created before a parent.
There is some metadata in the Cove database (liked comments, pinned comments) that is not exported at the moment – it doesn’t look like those are supported anyway.