=== RanksFactor IA ===
Contributors: ranksfactor
Tags: llms, markdown, ai, seo, content
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Publish llms.txt, llms-full.txt, and a Markdown version of every public page for AI agents.

== Description ==

RanksFactor IA publishes the files AI agents look for when they read a site.

* `/llms.txt` is a curated Markdown index of public content, following the llms.txt convention.
* `/llms-full.txt` concatenates the Markdown body of those documents. It is built in the background and cached in the uploads directory.
* Customize llms.txt and Customize llms-full.txt let you publish your own Markdown instead. Leave the box empty, or turn the switch off, and the generated file is served again. Custom text is published as you wrote it, including any private URL you paste in.
* Every public page, post, and supported archive can be read as Markdown with `?md`, with a `.md` suffix, or, when you turn it on, with `Accept: text/markdown`.
* `/agents.md` is optional. When you turn it on, it publishes instructions for agents and points them at `llms.txt` and the Markdown URLs. Leave the instructions box empty to use the generated guide, or write your own Markdown.

The HTML page stays canonical. Generated files send `X-Robots-Tag: noindex` and a `Link` header pointing back at the HTML URL, so the Markdown copy is not a second indexable document.

Password-protected, private, unpublished, and attachment content is never included. noindex flags from Yoast SEO, Rank Math, SEOPress, All in One SEO, and The SEO Framework are honored. Each document and term can be excluded from the editor.

Gutenberg content is converted from blocks. Classic content, shortcodes, and page builders can be rendered through `the_content` before the HTML is converted to GitHub Flavored Markdown.

= What the plugin does not do =

The plugin does not call an AI provider, does not track visitors, and does not phone home. See External services below.

== Installation ==

1. Upload the plugin directory to `/wp-content/plugins/ranksfactor-ia`, or install the zip from the Plugins screen.
2. Activate RanksFactor IA through the Plugins screen. Pretty permalinks are recommended.
3. Open RanksFactor IA and choose which post types belong in `llms.txt`.
4. Visit `/llms.txt` and append `?md` to a public permalink to confirm the Markdown response.

If a physical `llms.txt` already exists in the WordPress root, the web server will serve that file instead of this plugin. Move it aside. The Diagnostics tab reports this.

On Nginx, requests for `.txt` files must be passed to WordPress (PHP). A location that serves unknown `.txt` files as static files will bypass the plugin.

== Frequently Asked Questions ==

= How do I request the Markdown version of a page? =

Append `?md` to the permalink, for example `https://example.com/about/?md`. You can also request `https://example.com/about.md` when the suffix option is enabled. Both return `Content-Type: text/markdown`.

The site root suffix form is `/index.md`.

= Will the Markdown URLs compete with my HTML pages in search? =

Generated responses send `X-Robots-Tag: noindex, nofollow` and `Link: <html-url>; rel="canonical"`. The HTML response advertises the Markdown URL with `rel="alternate"` and `type="text/markdown"`. The plugin does not add Markdown URLs to sitemaps.

= Why does llms-full.txt return 503? =

The full file is generated in batches by WP-Cron so a large catalog does not exhaust a single request. The first request schedules the job and returns `503` with `Retry-After`. Later requests serve the cached file from `uploads/ranksfactor-ia/`. If `DISABLE_WP_CRON` is set, run `wp ranksfactor-ia regenerate --full` or use Rebuild on the Diagnostics tab.

= What is left out of the files? =

Unpublished, private, and password-protected content; attachments; post types you did not include; documents and terms you excluded; products hidden from the WooCommerce catalog; and, by default, anything an integrated SEO plugin marks noindex.

Membership plugins can veto a document with the `rfia_can_expose_post` filter.

= Does this conflict with Yoast, Rank Math, or another llms.txt feature? =

It can. Only one plugin should answer `/llms.txt`. Diagnostics names the SEO plugins it recognizes. Turn off llms.txt in this plugin and keep Markdown, or turn off the other generator. The response header `X-Generated-By: RanksFactor IA` identifies a file produced here.

= Does Accept negotiation affect normal visitors? =

It is off by default. When enabled, Markdown is returned only when `text/markdown` has a strictly higher quality value than `text/html`. The HTML response then includes `Vary: Accept`. Caches that ignore `Vary` should leave this option off. `?md` and `.md` are separate URLs and do not depend on `Vary`.

= Is it compatible with multilingual sites and multisite? =

WPML and Polylang keep their normal query filters, so `/llms.txt` follows the current language. Each post's language is written into the Markdown front matter. On multisite, settings and cached files are stored per site.

= How do developers extend it? =

* `rfia_settings`
* `rfia_can_expose_post`
* `rfia_is_noindex`
* `rfia_llms_txt_sections`
* `rfia_llms_txt_output`
* `rfia_llms_full_document`
* `rfia_markdown_frontmatter`
* `rfia_markdown_output`
* `rfia_markdown_url`
* `rfia_block_to_markdown_{block}` for example `rfia_block_to_markdown_core_paragraph`
* `rfia_full_batch_size`
* `rfia_full_max_docs`

WP-CLI:

* `wp ranksfactor-ia status`
* `wp ranksfactor-ia regenerate`
* `wp ranksfactor-ia regenerate --full`
* `wp ranksfactor-ia export <id>`
* `wp ranksfactor-ia export --url=<permalink>`
* `wp ranksfactor-ia flush-cache`

Authenticated REST routes live under `ranksfactor-ia/v1` and require `manage_options`, except Markdown preview, which requires `edit_post` for the requested post.

== External services ==

This plugin does not connect to external services. It does not send site content, visitor data, account data, or credentials off the server. `llms.txt` and Markdown pages are rendered locally. `llms-full.txt` is written locally by WP-Cron.

The Diagnostics loopback check requests your own site URL with `wp_remote_get` so you can see whether `/llms.txt` is answered by this plugin. That request stays on your server.

== Changelog ==

= 1.0.0 =
* Initial release with llms.txt, llms-full.txt, `?md`, `.md`, and optional Accept negotiation.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
