Skip to content

serpapi/ghost-repub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ghost-repub

A Ruby script that converts a Ghost blog post into a Markdown file with YAML frontmatter, ready for cross-posting to platforms like dev.to. Originally created to republish SerpApi blog posts.

Features

  • Extracts post metadata like title, description, tags, cover image, publication date, and canonical URL
  • Converts Ghost post content (section.post-full-content) to Markdown via reverse_markdown
  • Handles Ghost bookmark cards, rendered as Markdown list links
  • Handles Ghost image cards, preserves images with alt text and captions
  • Handles Ghost callout cards, rendered as Markdown blockquotes with emoji
  • Preserves code blocks with language syntax hints
  • Generates a YAML frontmatter preamble compatible for dev.to
  • Saves output to <slug>.md derived from the post URL

Usage

Install dependencies:

bundle install

Run the script with a Ghost post URL:

ruby ghost-repub.rb <post-url>

You can also make it executable and move it to your PATH:

chmod +x ghost-repub.rb
mv ghost-repub.rb /usr/local/bin/ghost-repub

Example:

ghost-repub https://yourblog.com/my-post/

The script saves the result to my-post.md in the current directory.

Platforms

Here's how to use the output to republish to different platforms.

Dev.to

The output should be immediately pastable into the dev.to editor as is. Some Ghost blocks formatting might not be implemented, so it's worth to do a quick visual scan.

Hashnode

The output body should be immediately pastable into the Hashnode editor. However, you need to use the metadata from the frontmatter to set the title, tags, and canonical URL. To set canonical URL, add it under Publish -> Discovery -> Set Canonical URL. You also need to reupload your cover image.

Contributing

Feel free to open a PR.

© 2026 SerpApi

About

Republish your Ghost posts to other platforms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages