Linux 软件免费装
Banner图

Markdown Twin

开发者 koekiseo
更新时间 2026年11月18日 13:20
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

woocommerce markdown json-ld ai agents content negotiation

下载

1.1.6

详情介绍:

Markdown Twin gives AI agents a clean Markdown version of every page, built from the page as it is actually rendered, whatever the theme or page builder: the content, without the menus, scripts, sliders and cookie banners an agent would otherwise spend its tokens on. Each twin starts with a YAML front matter: title, description, canonical URL, language, dates, author, image, the same page in the other languages, the breadcrumb trail, the page's whole schema.org JSON-LD as printed by your SEO plugin, your theme or WooCommerce (empty values left out, each node of a @graph on its own), and, for a product, the price as your shop displays it, currency, availability, SKU, attributes, variations and rating. How agents get it The publishers' crawlers fetch HTML today: the .md URLs and /llms.txt are what they can find and follow, and content negotiation serves the tools and agent frameworks that ask for Markdown. Each answer says what it is: X-Markdown-Twin-Cache (HIT; age=N, MISS or BYPASS: a kept copy, a fresh render, or never kept) and X-Markdown-Tokens (an estimate). Built for real sites For developers Filters markdown_twin_supported, markdown_twin_front_matter, markdown_twin_body_before, markdown_twin_body_after, markdown_twin_output, markdown_twin_product_facts, markdown_twin_product_rows, markdown_twin_max_variations, markdown_twin_llms_sections, markdown_twin_server_rules, markdown_twin_max_bytes, markdown_twin_max_transcript_bytes, markdown_twin_media_hosts, markdown_twin_agents, markdown_twin_stats_detail_families, markdown_twin_referral_sources, markdown_twin_visit_cap, markdown_twin_visit_cap_site, markdown_twin_link_resolution, markdown_twin_cache_hosts, markdown_twin_cache_max_files, markdown_twin_restricted (a content kept for members, whose text never makes a description), markdown_twin_site_closed (the site is closed to visitors: no Markdown version, no llms.txt): add them at the top level of a plugin file or of a must-use plugin, not in a theme nor inside a hook (a twin kept ready, or a refusal, is sent before the theme and the other hooks run). Commands: wp markdown-twin render <url>, stats, check, cache status|flush. Function: markdown_twin_url( $url ). In your templates, data-md="skip" leaves a block out and data-md="keep" always keeps it.

安装:

  1. Install and activate the plugin.
  2. Open Settings > Markdown Twin and pick the content types that get a twin (posts, pages and products by default).
  3. Try /index.md on your site, or curl -H "Accept: text/markdown" https://your-site/.
Behind a page cache, the .md URLs need no rule. For content negotiation, the Diagnostic tab offers the .htaccess rule (Apache, LiteSpeed) or shows the lines to add for nginx, Varnish and Cloudflare.

屏幕截图:

  • The dashboard widget "AI reads": the last 30 days in one sentence.
  • Overview: who reads your pages, per AI agent, and the state of the site.
  • The radiography of a page: what AI agents read, what is left out and why.
  • Diagnostic: what agents get, test by test.
  • The editor panel: "No Markdown version", the note for AI agents, "Media on this page".
  • Publisher facts: what every twin says about the publisher.
  • AI access: which agents may read your site, with what their publishers say of robots.txt.

升级注意事项:

1.1.5 Security hardening after the plugin review, and text no longer lost in the twins: sale prices, grouped products, line breaks, code, the notes typed in the editor. After updating, purge your page cache (LiteSpeed Cache keeps the .md URLs for its own cache time).

常见问题:

Does activating the plugin change my .htaccess?

No. The rule for content negotiation behind a page cache is written only when you ask for it in the Diagnostic tab, after a backup copy of the file (the last copy is kept until uninstall). The same tab removes it, with the same backup; deactivating the plugin removes it too (on a network: deactivating it for the whole network; when it was activated site by site, the uninstall removes it). While the plugin is active, when W3 Total Cache, WP Super Cache or WP Rocket write their own .htaccess rules again, they get one more condition, so that Markdown requests skip their cache files.

My site has a page cache. Does content negotiation work?

The .md URLs always work. Content negotiation (the normal URL with Accept: text/markdown) needs the cache to let these requests through, and the Diagnostic tab tells you what to add: a few lines for wp-config.php with the caches that answer from advanced-cache.php (WP-Optimize, Breeze, W3 Total Cache, Cache Enabler, SiteGround Speed Optimizer…), a file registered in WP Super Cache after your confirmation, the Markdown condition in WP Rocket's rules, or a line for Varnish, nginx and Cloudflare, to add to the server configuration or to ask your host for. The WP Rocket and LiteSpeed Cache integrations are written from their code, not tested with them.

Does Markdown Twin keep the twins ready?

Yes, as files in wp-content/uploads/markdown-twin-cache/ (Settings, "Performance": how long, 12 hours by default, 0 turns it off; a button and wp markdown-twin cache flush empty it). A twin is made again when its page, its product or the pages that list it change, and everything is emptied when the site changes as a whole (theme, menus, plugins, settings) or when a known page cache empties itself. Never kept: logged-in users, requests with a cookie or a query string, protected content, errors, noindex pages. With the currency switchers it recognises (FOX Currency Switcher, CURCY, WPML Multicurrency, Currency Switcher for WooCommerce, Price Based on Country) or WooCommerce taxes based on the visitor's location, products and shop pages are rendered for each request; with another currency plugin, set the kept time to 0. Not followed: the "purge everything" of some caches. A kept twin is served only while a look at the site as a visitor without an account, made at most 15 minutes earlier, found it open; a site that cannot ask itself (some hosts, PHP's built-in server) renders every request. A twin takes a few kilobytes; at most 5,000 are kept (filter markdown_twin_cache_max_files), only for requests that name your own site (filter markdown_twin_cache_hosts for a domain per language). An update of Markdown Twin made from WordPress (the Plugins screen, automatic updates, WP-CLI; not a copy of its files by FTP) empties its own twins, not those a page cache holds: LiteSpeed Cache keeps the .md URLs for its own cache time (a week by default), so purge it after updating. Reads answered from a page cache never reach WordPress and are not counted in the statistics.

How much space do the statistics take?

About 100 bytes per row. Reads by the agents that read for a person and by AI search crawlers are counted per page and per day; the others per site. A 2,000-page site read daily by three such agents adds about 0.6 MB a day; keep 60 days, or count AI search per site with the filter markdown_twin_stats_detail_families. Rows older than the retention period (60, 90 or 365 days) are deleted every day.

What do the visits sent by AI assistants count?

When you turn it on, a short script on the pages that have a Markdown version looks at where the visitor comes from; only when it is ChatGPT, Perplexity, Claude or Gemini, it sends the page and the name of the assistant to your site, which adds one to a daily counter. No IP address, no cookie, nothing kept in the browser. Not counted: Google's AI answers (they come from google.com), apps that hide the referrer, visitors without JavaScript. An indication, not an audience measure; each page counts at most 5,000 visits a day. The script is kept out of the delay of WP Rocket, Perfmatters, LiteSpeed Cache and Cloudflare Rocket Loader, out of Autoptimize's optimization and out of SiteGround Optimizer's combining; with FlyingPress, exclude markdown-twin-visit yourself.

Can an AI agent read my videos, audio and documents?

It gets a link to each one and, under it, the transcript or the description when there is one: the subtitles of a video or an audio of your media library (a WebVTT track, read on the disk), or the text you write for each media in the editor ("Media on this page"). Nothing is fetched from YouTube or any other site. With Polylang, write the texts on each language's page; with TranslatePress or Weglot, they stay in the language you wrote them in.

What can an AI agent not read?

What is built in the browser only: reviews loaded by a script, application forms that are JavaScript apps, automatic tables of contents, content loaded when scrolling. Nor the text drawn in an image, or a background image set in CSS. What a cookie banner removes from the HTML itself is not read either. For what matters, write it in the note for AI agents of the page, and keep your structured data complete: both are read before anything else. A rule of your web server or CDN that protects a path (HTTP authentication, a list of allowed addresses) is not seen by WordPress: protect the matching .md address and llms.txt the same way, as well as WordPress's REST API, which publishes the same text.

Something from my theme shows up in the Markdown and should not.

Add its CSS selector to "Parts to leave out" in the settings, or add data-md="skip" to the element in your template. If the wrong part of the page is used, switch the content area to your own CSS selectors.

Can I block AI agents?

Settings > Markdown Twin > AI access: one line per agent, "Allowed" (default) or "Blocked", grouped by what the agent does, with what each publisher says of robots.txt and the date it was read. Blocking an agent writes a User-agent line for it in the robots.txt WordPress builds (never a group with Allow: /), and Markdown Twin refuses it its Markdown versions and llms.txt with a 403 that is never cached. What to know: robots.txt is a request, not a lock, and the agents that read a page for someone may not follow it; an agent can lie about its name; a page cache, a server cache or a CDN can serve an older robots.txt, an HTML page or a Markdown version kept before the blocking (the tab shows rules for Apache, LiteSpeed and nginx to refuse the HTML pages too, to copy yourself); a robots.txt file at the root of your site is served instead of the one WordPress builds, so the tab shows the lines to copy. An optional Content-Signal line (Content Signals policy, CC0) is shown before you save: search=yes always, ai-train from the Training family, ai-input from the AI search and "for a person" families, each written only when the whole family is blocked or allowed. On a network in sub-directories, robots.txt is served at the root of the network only: the main site's setting applies to every site, and only the network administrator can change it.

Is a read really from the agent it names?

Agents name themselves, and anyone can write "GPTBot". With "Verify the agents' addresses" (Settings > Statistics, off by default), Markdown Twin downloads once a week the IP address lists the publishers publish on their own sites (see "External services") and marks each read as coming from the agent's addresses or not: "From its addresses", "claimed to be it" when the address was compared and is not in the list, "not checked" for the reads made before the option was on or while the list was not on your site, "no list" when the publisher publishes none. The reader's IP address is compared and never stored. Behind a proxy or a CDN, designate the header that carries the reader's address (X-Forwarded-For, last address; X-Real-IP; CF-Connecting-IP; True-Client-IP): it is never trusted otherwise, and while such a header reaches the site with none designated, nothing is compared ("not checked") and the Diagnostic tab names the header it saw: designate it only if your proxy or CDN writes it, since anyone can send it. The Diagnostic tab says when a list is missing, failed or more than 15 days old; a download that fails keeps the last valid list.

Does it work without WooCommerce?

Yes. WooCommerce only adds the product facts.

Does it work on multilingual sites?

With Polylang and TranslatePress, yes: "/fr/page.md" is the twin of "/fr/page/", in French, with links to the same page in the other languages. A plugin that removes the language prefix ("/fr/") from the address when its own file loads must load after Markdown Twin: a plugin whose folder name sorts after "markdown-twin", or the theme. Loaded before it (a must-use plugin, a plugin whose folder sorts before, a plugin activated for a whole network), it hides the prefix from Markdown Twin: the twins of its language pages are made for the address without the prefix, and share their links and kept twins with the default language. On such a site, set the kept time to 0.

Is there a llms.txt?

Yes, at /llms.txt, unless the site already has one (a file at the root, or one that another plugin already serves: the common ones are recognised, and Markdown Twin steps aside). On multilingual sites (Polylang, TranslatePress), each language home has its own ("/fr/llms.txt", listing the French pages), and every one has a "Languages" section; none while the site asks search engines not to index it.

更新日志:

1.1.6 1.1.5 1.1.3 1.1.2 1.1.1 1.1.0 1.0.0