=== Whizz MD — Markdown Endpoints for AI Crawlers ===
Contributors: whizzpeople
Tags: markdown, ai, llm, seo, crawler
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.0.5
Requires PHP: 8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Serve every WordPress post and page as a clean .md file with full SEO frontmatter — discoverable by AI crawlers and search engines on the fly.

== Description ==

**Whizz MD** automatically creates a `.md` version of every published post and page on your WordPress site, served dynamically without storing any files on disk.

AI-powered search engines and LLM crawlers (GPTBot, ClaudeBot, PerplexityBot, Googlebot) increasingly prefer clean, structured content. This plugin gives them exactly that — a Markdown file with rich YAML frontmatter containing all your SEO signals, served at a predictable URL like `/your-post-slug.md`.

= How It Works =

1. Any published post or page automatically gets a `.md` endpoint
2. AI crawlers discover it via a `<link rel="alternate">` tag in your page `<head>`, a dedicated `/md-sitemap.xml`, and crawlable anchor links in your page content
3. The Markdown is generated on the fly — no files written to disk, no database bloat
4. Full YAML frontmatter is included with all SEO metadata

= What Gets Generated =

**YAML Frontmatter includes:**

* `title` — SEO title (from Yoast, Rank Math, AIOSEO, or post title)
* `slug` — post slug
* `date` and `modified` — publication and last modified dates
* `author` — author display name
* `meta_description` — SEO meta description (from SEO plugin or auto-generated)
* `focus_keyword` — primary keyword (from Yoast/Rank Math)
* `canonical_url` — points back to your HTML page
* `og_title` and `og_description` — Open Graph fields
* `og_image` — featured image URL
* `schema_type` — auto-detected (Article, HowTo, FAQPage, WebPage)
* `categories` and `tags`
* `reading_time` and `word_count`
* `robots` — respects your SEO plugin's noindex settings
* `lang` — site language (WPML/Polylang compatible)

**Markdown Body includes:**

* H1–H6 headings with anchor ID preservation
* Bold, italic, strikethrough, inline code
* Fenced code blocks with language detection
* Ordered and unordered lists (nested)
* GitHub Flavored Markdown (GFM) tables
* Blockquotes, images with alt text, links (relative → absolute)
* Gutenberg block HTML stripped cleanly

= URL Patterns =

* `/your-post-slug.md` — clean pretty permalink
* `/parent/child-page.md` — works with nested pages
* `/?p=123&format=md` — query string fallback

= AI Crawler Discovery =

The plugin automatically:

* Adds `<link rel="alternate" type="text/markdown">` to every page `<head>`
* Registers `/md-sitemap.xml` listing all `.md` URLs
* Appends explicit `Allow: /*.md` rules to `robots.txt` for all major AI crawlers
* Injects a crawlable `<a>` link on each page so robots can follow it naturally

= SEO Plugin Compatibility =

* ✅ Yoast SEO
* ✅ Rank Math
* ✅ All in One SEO (AIOSEO)
* ✅ WPML
* ✅ Polylang
* ✅ Gutenberg (Block Editor)
* ✅ Classic Editor

= No Duplicate Content Risk =

The `.md` endpoint serves `Content-Type: text/markdown`, not `text/html`. An HTTP-level `Link: rel="canonical"` header points back to the original HTML page, and `X-Robots-Tag: noindex, follow` prevents Google from indexing the raw Markdown as a competing webpage — while still allowing AI crawlers to read it.

= Why This Matters =

LLMs and AI search engines crawl the web to build their knowledge. Clean, structured Markdown with rich YAML frontmatter is the ideal format for these systems to parse, index, and cite your content — giving you organic visibility in AI-powered search results, summaries, and citations.

== Installation ==

1. Upload the `whizz-md` folder to `/wp-content/plugins/`
2. Activate the plugin via **Plugins → Installed Plugins**
3. Go to **Settings → AI Crawlers MD** to configure post types and options
4. Visit **Settings → Permalinks** and click **Save Changes** to flush rewrite rules
5. Optionally submit `/md-sitemap.xml` to Google Search Console

== Frequently Asked Questions ==

= Will this hurt my SEO or create duplicate content? =

No. The `.md` endpoint uses `Content-Type: text/markdown` (not HTML), includes an HTTP-level `Link: rel="canonical"` header pointing to the original page, and sets `X-Robots-Tag: noindex, follow` so Google won't index it as a competing page.

= Which AI crawlers will find my .md files? =

GPTBot (OpenAI), ClaudeBot (Anthropic), PerplexityBot, Googlebot, Bingbot, and any other crawler that follows standard anchor links, sitemaps, or robots.txt Sitemap directives.

= Do I need Yoast SEO or Rank Math installed? =

No. If no SEO plugin is active, the plugin auto-generates the meta description and other fields from your post content. SEO plugins enhance the output but are not required.

= Does it work with Gutenberg (Block Editor)? =

Yes. The HTML-to-Markdown converter handles all standard Gutenberg block output — paragraphs, headings, lists, images, tables, code blocks, quotes, and more.

= Does it work with page builders like Elementor or Divi? =

Partially. The converter processes `the_content` filter output, which most page builders use. A footer anchor fallback is also included for builders that render content outside this filter.

= How do I exclude specific pages from getting a .md endpoint? =

Go to **Settings → AI Crawlers MD** and enter the post IDs you want to exclude in the "Exclude Post IDs" field.

= Where is the md-sitemap.xml? =

At `https://yourdomain.com/md-sitemap.xml`. If it returns a 404, go to **Settings → Permalinks** and click Save to flush rewrite rules.

= Does this slow down my site? =

No. The `.md` endpoint is only triggered when a `.md` URL is requested. Normal page loads are completely unaffected. The Markdown is cached via HTTP headers (`Cache-Control`, `ETag`) to avoid regeneration on every request.

== Screenshots ==

1. Settings page — configure post types, cache duration, and excluded IDs
2. Example .md output with YAML frontmatter and Markdown body
3. robots.txt showing AI crawler rules added automatically

== Changelog ==

= 1.0.0 =
* Initial release
* Dynamic .md endpoint generation for posts and pages
* Full YAML frontmatter with SEO metadata
* Yoast SEO, Rank Math, and AIOSEO compatibility
* WPML and Polylang language support
* Auto-detected schema type (Article, HowTo, FAQPage, WebPage)
* Dedicated /md-sitemap.xml
* robots.txt integration for AI crawlers
* HTTP-level canonical and noindex headers
* ETag and Cache-Control support

== Upgrade Notice ==

= 1.0.0 =
Initial release. After activating, visit Settings → Permalinks and click Save to flush rewrite rules.
