=== Townsmith – Local Pages Engine ===
Contributors: thestephenevans
Tags: local seo, landing pages, service areas, schema, internal linking
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate quality-controlled service-area landing pages — real, editable WordPress pages with schema, linking and a per-page quality score.

== Description ==

Local Pages Engine is for local service businesses and the agencies that build their sites. Define your services and the areas you cover, design one page blueprint in the block editor, and generate the matrix of landing pages as real WordPress pages — each individually editable, never auto-published, and each held to a per-page Quality Score before it goes live.

Unlike bulk page generators, Local Pages Engine is built quality-first: fewer pages, enforced uniqueness, and publish gates designed to keep the pages it produces defensible under Google's scaled-content and doorway-page policies.

**What it does**

* **Real pages, never virtual.** Generated pages are ordinary WordPress pages: editable in the block editor, owned by you, and fully intact if the plugin is ever deactivated. Merge tokens are resolved at generation time, not at render time.
* **One blueprint, deterministic variation.** Design a single template with merge tokens, copy variations that rotate deterministically per page, and a local content slot that starts empty on every page — because the genuinely local part is yours to write.
* **A Quality Score with teeth.** Every generated page is scored 0–100: similarity against its sibling pages (5-word shingle comparison), local substance (filled slots, area descriptors, local imagery), and a thin-content floor. The pre-publish panel shows exactly what to fix and links to the spot, and warns before a below-threshold page publishes.
* **Schema that cooperates.** One JSON-LD graph per page — LocalBusiness, Service with areaServed, breadcrumbs, FAQ. If Yoast SEO, Rank Math, All in One SEO or SEOPress is active, Local Pages Engine steps back and emits only the Service piece, wired to the host plugin's organisation — never a duplicate LocalBusiness.
* **Hub-and-spoke linking that survives.** Each service gets a hub page; each area page carries an "Areas we cover" block and a breadcrumb back to its hub. The links are baked into the saved markup, refreshed automatically as the area set changes, and keep working even with the plugin deactivated.
* **Safe sync.** When the blueprint changes, a review screen shows exactly what would change on each page. Blocks you have edited are yours: sync never overwrites them, and a deleted block is never re-added. No silent background rewrites, ever.
* **Resumable background generation.** Generation runs through a batched queue built for cheap shared hosting — interrupt it anywhere and it resumes without duplicates.

Local Pages Engine runs entirely on your own site: no external services, no API calls, no AI generation, no telemetry. Your data never leaves your install.

**The Pro add-on**

This plugin is complete as it stands: unlimited generation across every service and area, the full Quality Score, deterministic variant rotation, the advisory publish gate, schema, linking and sync. A separate Pro add-on, distributed from townsmithwp.com, adds a reusable local-proof library for the area content slot, a portfolio duplicate radar, a pre-generation saturation planner, self-hosted conversion attribution, bulk CSV import and export, scheduled drip publishing, portable blueprint kits, a multi-site command centre for agencies, a signed defensibility dossier, an enforceable publish gate, bulk re-scoring and sync, geo-ordered related areas, noindex-below-threshold, and slug updates that serve their own 301 redirects or report each move to your redirect manager.

== Frequently Asked Questions ==

= Does this plugin send my data anywhere? =

No. Everything runs on your own WordPress install. There are no external API calls, no AI services, and no telemetry of any kind.

= What happens to generated pages if I deactivate or uninstall the plugin? =

Nothing. Generated pages are real WordPress pages and remain fully intact, editable, and rendering — including their internal links, which are baked into the saved markup. Uninstalling removes the plugin's settings and queue table only (and even that can be kept with a setting).

= Will it conflict with my SEO plugin? =

No. Yoast SEO, Rank Math, All in One SEO and SEOPress are detected at render time. When one is active, Local Pages Engine suppresses its own meta description and emits only the Service schema piece, referencing your SEO plugin's organisation data.

= Can it overwrite content I've edited? =

No. The moment you edit a generated block, that block is yours. The sync flow updates only untouched blocks and shows you a per-page preview before anything is applied.

= Why did publishing my page get blocked? =

Its Quality Score is below your threshold and the Pro add-on's enforcement mode is switched on (this plugin only warns). The pre-publish checklist lists exactly what to fix — usually filling the local content slot, writing an area descriptor, or making the copy less similar to a sibling page.

== Screenshots ==

1. The dashboard. A services × areas matrix with every page's status and Quality Score. Generate the whole set, or any single page, from one screen.
2. One blueprint, designed in the block editor: merge tokens, deterministic copy variants, and a local content slot that starts empty for you to fill. Sibling-area links are baked into the saved page.
3. The Quality screen. Every generated page scored 0–100 against its closest sibling, with a plain-English list of what to fix before it publishes.
4. The setup wizard. Define your business, your services, and the areas you cover, then pick a blueprint, in a few guided steps.
5. The pre-publish Quality Score panel, right inside the block editor. Every page is scored before it goes live, with the breakdown and a plain-English list of what to fix.
6. The blueprint sync review. Change the blueprint once and see exactly what would update on each page. Blocks you have edited are kept, never overwritten.

== Development ==

The human-readable source of the compiled files in `build/` ships in this plugin's `src/` directory, alongside `package.json` and `webpack.config.js`. To rebuild: `npm install && npm run build` (uses @wordpress/scripts). Development happens in a private repository; the distributed zip always contains the complete, current source.

== Changelog ==

= 1.0.1 =
* Generation runs are now unlimited: every selected service and area is generated, and variation blocks rotate through all authored variants.
* Hardened capability checks: page disposal and per-page sync and re-scoring now verify edit or delete rights on each affected page, not only a broad role capability.

= 1.0.0 =
* First public release: blueprint blocks and merge engine, resumable batched generation, the Quality Score with pre-publish panel and publish gate, schema output with SEO-plugin cooperation, hub-and-spoke linking with deactivation-safe markup, blueprint sync with human-edit protection, and the admin app (wizard, dashboard, quality, settings).
