Ghost posts to Markdown for AI-bots and others

I built a small Cloudflare Worker for Ghost that lets any published post be fetched as Markdown just by changing the URL:

The goal is simple: make Ghost posts easier to archive, quote, save to notes apps, or reuse in static site workflows without needing a separate export step. Also, AI-bots love reading Markdown.

How it works:

  • Normal page requests still go straight to Ghost
  • The Worker injects a tag into post pages
  • Requests ending in .md are handled by the Worker
  • The Worker fetches the post through the Ghost Content API
  • Ghost HTML is converted to Markdown with YAML frontmatter

The Markdown response includes:

  • title
  • published date
  • tags
  • canonical URL
  • post body converted from Ghost HTML

A few implementation details that may be useful to others:

  • it runs on Cloudflare Workers - your domain must be behind Cloudflare
  • it uses a read-only Ghost Content API key
  • it caches generated Markdown at the edge

This is currently aimed at published posts. It is not meant to be a full replacement for Ghost’s export tools, just a lightweight per-post Markdown endpoint.

2 Likes

Hello,

Thanks for sharing this.

Do LLMs automatically check “alternate” links on HTML responses and use Markdown if present? Is there a convention like this?

Cloudflare recently announced something similar: Introducing Markdown for Agents It’s not included in Free plan though. It uses Accept header instead of a separate URL.

In the meantime, many Ghost publishers are rather trying to “protect” their content from LLMs :blush: But I also see some reasonable use cases (like a product site or a documentation) for this as well.

1 Like

I was inspired by this post from the Drupal-founder The Third Audience | Dries Buytaert

Most of the LLMs do check alternative links and use Markdown if present. They also seem to check the original HTML content as well, but I presume it is a good idea for LLM visibility to give them markdown also.

Dries wrote more about his results here:

Cloudflare’s approach is also very interesting, but limited by only being available to 20$/m Pro accounts and not integrated with the Ghost API. I’ll see if I can support their native solution as well down the road.

This is absolutely the opposite of blocking access to LLMs which I fully understand why someone would do, but there are also use cases for the opposite.

1 Like

I’ve now also added rudimentary support for llms.txt https://llmstxt.org. The code will create an /llms.txt file as well. So far not really any evidence that LLMs actually use this, but it is a proposed standard.