=== Lesuto Render Engine ===
Contributors: lesuto
Tags: seo, crawlers, javascript, cache, ai search
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

30,000 free renders a month. Search, social and AI crawlers get the finished HTML of your pages, and it refreshes when you publish.

== Description ==

Pages built with JavaScript (page builders, headless themes, interactive blocks, product filters) often look empty to crawlers that do not run scripts. Lesuto Render Engine renders those pages in a real browser and sends crawlers the finished HTML, so search engines, link previews and AI assistants see what your visitors see.

This plugin connects a WordPress site to [Lesuto Render Engine](https://lesutorender.com). It needs a Render Engine workspace and an API key. **The Free plan includes 30,000 renders a month**, and pages served from the cache never count.

= What it does =

* **Sends crawlers the rendered page.** Googlebot, Bingbot, Applebot, social link previews (Facebook, X, LinkedIn, Slack, Discord, WhatsApp and more) and AI crawlers and assistants (GPTBot, ChatGPT, ClaudeBot, Perplexity and more) get the rendered HTML. Everyone else gets your site exactly as before.
* **Never breaks your site.** If Render Engine is slow, refuses a request or is unreachable, the crawler gets your normal WordPress page.
* **Purges on publish.** When you update a post, page, product, category or menu, the cached copies of the pages it appears on are purged, and the changed page and your home page are rendered again before the next crawler asks.
* **Renders your sitemap ahead of crawlers.** The plugin registers your sitemap (from Yoast SEO, Rank Math, All in One SEO, SEOPress, Slim SEO or WordPress itself) so new pages are rendered before crawlers find them.
* **Shows what crawlers do.** A dashboard widget and the settings page show this month's renders against your plan, crawler visits by search, AI and social, the cache-hit share, your most crawled pages, crawlers by name and recent failed renders. You get a notice at 80% and 100% of your plan.
* **Status for every page.** A Render column in the Posts, Pages and Products lists says when crawlers last got each page, and whether it was rendered, served from the cache or failed.
* **Purge and render again, page by page.** From a row action, a bulk action, the editor or the admin bar on the live page.
* **View as crawler.** From the editor, see the HTML a crawler gets for the page next to what WordPress sends: title, visible words, links and headings, before and after.
* **WooCommerce aware.** Price, sale, stock and variation changes purge the product page, its categories and the shop.
* **Multisite.** Network activate it, then give each site its own key or set one key for the whole network.
* **Site Health checks.** Tools → Site Health says whether Render Engine is connected, and warns when a page cache in front of WordPress (Cloudflare, LiteSpeed, WP Engine, Kinsta, SiteGround, Varnish or nginx) could answer crawlers first, with the user agents to exclude.
* **WP-CLI.** `wp lesuto-render status`, `wp lesuto-render purge <url>` and `wp lesuto-render purge --all`.
* **Checks your setup.** Settings → Render Engine checks your key, says whether your domain is verified, and lists your workspace's domains.

= What is never sent to Render Engine =

Signed-in users, wp-admin, the REST API, feeds, robots.txt, search results, 404 pages, password-protected posts, previews, static files and WooCommerce cart, checkout and account pages always get WordPress as usual. SEO audit tools are never rendered.

= How renders are counted =

Only fresh renders count toward your plan. Pages served from the cache are free. Rendering a changed page right away and rendering sitemap pages count as renders; both can be turned off in the settings.

== External services ==

This plugin connects to Lesuto Render Engine, a service run by Lesuto Technologies. It does nothing until an administrator saves a Render Engine API key under Settings → Render Engine.

After a key is saved, the plugin sends requests to `https://api.lesuto.com`:

* **When a crawler visits a page:** the page's address, the crawler's user agent and the address the crawler connected from (used to check that a visitor calling itself Googlebot really comes from Google), with your API key. Render Engine answers with the rendered page. Requests from people are never sent.
* **When content changes, or you choose Purge and render again:** the addresses of those pages, to purge their cached copies and render them again.
* **When you choose View as crawler:** the page's address, to read the copy crawlers get. It is asked for from your own address, so it never counts as a crawler visit or starts a render by itself; "Render it now" on that screen renders the page and counts as one render.
* **When you save the settings, open the settings page or view the dashboard:** your site's hostname, to check the key and read this month's renders and crawler visits.
* **When the sitemap setting is on:** your sitemap's address. Render Engine then reads your public sitemap and renders the pages listed in it.

Render Engine stores rendered copies of your public pages and counts of crawler visits for your account. No personal data about your visitors is sent.

The per-page status, top pages, crawler names and failed renders shown in wp-admin are counted by the plugin on your own site and stored in your WordPress database. They are not sent anywhere. Site Health fetches your own home page once to look for a page cache.

* Service: https://lesutorender.com
* Terms of Service: https://www.lesuto.com/legal/terms
* Privacy Policy: https://www.lesuto.com/legal/privacy

== Installation ==

1. Install and activate the plugin.
2. [Create a free workspace](https://lesutorender.com/auth/login?returnTo=%2Fapp%2Fkeys&signup=1) at lesutorender.com, or sign in with your Lesuto ID. Under **Domains**, add your site's domain (for example `yourbrand.com`, which also covers `www.yourbrand.com`) and publish the TXT record shown.
3. Under **API keys**, create a key. It starts with `lsr_` and is shown once.
4. In WordPress, open **Settings → Render Engine**, paste the key and save. The page shows whether your domain is verified.
5. If your site is behind Cloudflare or a load balancer, choose the matching **Crawler address** setting.

If you use a page caching plugin or a CDN cache, exclude crawler user agents from it, or crawlers may get a cached copy of the JavaScript page before this plugin runs. Tools → Site Health tells you when it finds one and lists the user agents to exclude.

On multisite, a network administrator can set one key for every site under Network Admin → Settings → Render Engine. A site's own key always takes precedence. Each site's domain still has to be added and verified in the workspace.

== Frequently Asked Questions ==

= Does this change what my visitors see? =

No. Only requests from the crawlers listed above are sent to Render Engine. Visitors and signed-in users get WordPress as usual.

= What happens if Render Engine is down, my plan's renders are used up or my plan ends? =

Crawlers get your normal WordPress page. Pages already in the cache keep being served when the month's renders are used up, until renders start again on the 1st of the month (UTC). If your plan ends or you move to a smaller one, the domains and renders past the new plan get your normal page the same way. Only pages Render Engine marks as rendered are ever passed to a crawler, so your site never shows crawlers an error or an empty page.

= I use the must-use plugin file from the Render Engine app. Do I need both? =

No. This plugin replaces that file. Delete `wp-content/mu-plugins/lesuto-render-engine.php` after you activate the plugin, or crawlers will be routed twice.

= I also use Lesuto Chameleon Commerce. =

Both work together. While this plugin routes crawlers, Lesuto Chameleon Commerce leaves crawler rendering to it, so pages are never rendered twice.

= How quickly does a change reach crawlers? =

Purges are sent by WP-Cron right after you save, usually within seconds. If your site turns off WP-Cron (`DISABLE_WP_CRON`), they are sent on your server's next cron run.

= Can I keep some pages out of Render Engine? =

Yes, with the `lesuto_render_engine_should_render` filter: return false for any page address that should always get WordPress.

= Which post types get the Render column? =

Every public post type with pages. Change the list with the `lesuto_render_engine_post_types` filter.

= My site uses a different public address than WordPress's home URL. =

Use the `lesuto_render_engine_page_url` filter to change the page address sent to Render Engine.

== Changelog ==

= 1.1.0 =
* Usage meter against your plan, with notices at 80% and 100%.
* Settings page: most crawled pages, crawlers by name, cache-hit share and recent failed renders on this site.
* Render column in the Posts, Pages and Products lists, with "Purge and render again" as a row action, bulk action, editor box and admin-bar item.
* View as crawler: the HTML crawlers get for a page, before and after.
* WooCommerce: product and variation saves (price, sale, stock) purge the product page.
* Multisite: a network key for sites without their own.
* Site Health: connection check and page cache detection.
* WP-CLI: `wp lesuto-render status | purge <url> | purge --all`.
* Crawlers get your normal page for any answer that is not a page Render Engine rendered: a plan that ended or was downgraded, renders used up, a revoked key, a suspended workspace, or an error page from anything in between.
* The settings page links to a free Render Engine workspace.

= 1.0.0 =
* First release: crawler routing, automatic purge and re-render on content changes, sitemap rendering, connection check and dashboard widget.

== Upgrade Notice ==

= 1.1.0 =
Per-page render status, view as crawler, usage notices, WooCommerce variation purges, multisite network key, Site Health checks and WP-CLI.

= 1.0.0 =
First release.
