Skip to content

Repository files navigation

AI Friendly Markdown

Serve your WordPress content as clean Markdown for AI agents and crawlers.

The Third Audience

For two decades, we built websites for two audiences: humans and search engines. AI agents are now the third audience, and most websites aren't optimized for them yet.

Inspired by Dries Buytaert's experiment.

Features

  • 📄 Markdown URL Endpoints — Append .md to any URL
  • 🤝 Content Negotiation — Automatic Markdown for Accept: text/markdown
  • 🔍 Auto-Discovery<link rel="alternate"> tags for AI crawlers
  • ⚙️ Configurable Metadata — Title, date, author, categories, tags, excerpt, featured image
  • 📝 YAML Front Matter — Structured metadata
  • 🎛️ Per Post Type Control — Enable/disable for specific post types

Installation

cd wp-content/plugins/
git clone https://github.com/jamesbrooksco/ai-friendly-markdown.git

Or download from WordPress.org and upload via Plugins > Add New.

Usage

Method 1: Append .md to URL

https://example.com/my-blog-post.md

Method 2: Content Negotiation

curl -H "Accept: text/markdown" https://example.com/my-blog-post/

Example Output

---
title: My Blog Post
date: 2024-01-15
author: James Brooks
categories:
  - Technology
tags:
  - AI
url: https://example.com/my-blog-post/
---

# My Blog Post

Content here...

Hooks & Filters

// Customize Markdown output
add_filter( 'aifm_markdown_output', function( $markdown, $post ) {
    return $markdown . "\n\n---\n*Via AI Friendly Markdown*";
}, 10, 2 );

// Customize metadata
add_filter( 'aifm_post_metadata', function( $metadata, $post ) {
    $metadata['custom_field'] = get_post_meta( $post->ID, 'custom', true );
    return $metadata;
}, 10, 2 );

Requirements

  • WordPress 5.0+
  • PHP 7.4+

License

GPL v2 or later

Credits

About

WordPress plugin that serves your content as clean Markdown for AI agents and crawlers. Auto-discovery, content negotiation, and .md URL endpoints.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages