=== Frontpagely ===
Contributors: parameterllc
Tags: seo, ai, llms-txt, answer engine optimization, redirects
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WordPress to Frontpagely: publish articles, apply reversible SEO fixes, and see your AI-visibility SeenRate in wp-admin.

== Description ==

[Frontpagely](https://frontpagely.com) measures how often AI assistants such as
ChatGPT, Perplexity, Claude, and Gemini mention your business, and gives you a
plan to improve it. This plugin is the WordPress side of that service. It needs a
Frontpagely account; without one it does nothing.

It does four jobs:

1. **Site adapter.** A hardened REST API under `/wp-json/frontpagely/v1/*`,
   authenticated with a per-site Bearer key you generate, so Frontpagely can
   create, update, publish, and unpublish articles. Writes use optimistic
   concurrency (If-Match / ETag) and idempotent retries (Idempotency-Key), and a
   post edited by a person is never overwritten by an automated write.

2. **SEO edits.** Optional, individually toggled, reversible, and logged:
   `llms.txt` / `llms-full.txt`, sitemap `lastmod` plus IndexNow pings, managed
   301/302 redirects with loop protection, and per-page meta description,
   canonical, and OpenGraph tags. It works alongside Yoast SEO and Rank Math: it
   defers to them where they own a field and only fills the gaps.

3. **Fix application.** Authenticated `/apply/*` routes preview, apply, verify,
   and revert scoped title/meta, canonical, schema, redirect, image alt-text,
   llms.txt, sitemap, and additive robots.txt changes. Every apply is idempotent
   and returns a rollback token, and every change can be reverted from
   **Frontpagely → Settings**. Nothing is written until you turn on the master
   permission and each fix type you allow.

4. **Metrics.** A dashboard widget and a Frontpagely admin page show your current
   SeenRate with a confidence badge, a trend line, per-engine scores, and a link
   to your fix plan in the Frontpagely app. Read-only.

The plugin never holds an AI-provider API key and never calls an AI assistant
itself. All SEO features are off by default.

== External services ==

This plugin connects to the following services. Nothing is sent until you
configure the plugin and turn the related feature on.

* **Frontpagely app** (`https://frontpagely.com`), run by Parameter LLC. Only
  when you press **Connect to Frontpagely**: your browser goes to Frontpagely
  with this site's address and a one-time code, and after you approve there,
  this site sends Frontpagely that approval code, this site's address and a
  newly made site key, and receives your business id, its name and a read-only
  plugin key.
  [Terms of Service](https://frontpagely.com/terms/) ·
  [Privacy Policy](https://frontpagely.com/privacy/)

* **Frontpagely API** (`https://api.frontpagely.com`), run by Parameter LLC.
  Once connected (or after you save a tracked entity id and plugin key by hand),
  the plugin requests your SeenRate, its recent trend and your top open fixes
  (sending the key, and the entity id for API keys) to show them in wp-admin.
  Results are cached for up to an hour.
  The **Test connection** button sends one request to the same API. Frontpagely
  also calls this site's `/wp-json/frontpagely/v1/*` routes with the key you
  generate, to publish articles and apply fixes you permitted.
  [Terms of Service](https://frontpagely.com/terms/) ·
  [Privacy Policy](https://frontpagely.com/privacy/)

* **IndexNow** (`https://api.indexnow.org`). Only after you enter an IndexNow
  key: when Frontpagely publishes a post with the sitemap feature on, or applies
  a sitemap fix you permitted, the plugin sends the changed URLs, your site's
  host name, and your IndexNow key so participating search engines can recrawl
  them.
  [IndexNow documentation and terms](https://www.indexnow.org/documentation) ·
  [Microsoft Privacy Statement](https://privacy.microsoft.com/privacystatement)

* **Article images.** When Frontpagely publishes an article that includes a
  featured image URL, the plugin downloads that image into your Media Library.
  No data about your site is sent beyond the standard HTTP request.

== Installation ==

1. In wp-admin go to **Plugins → Add New**, search for "Frontpagely", and click
   **Install Now**, or upload the zip under **Plugins → Add New → Upload Plugin**.
2. Activate the plugin.
3. Go to **Frontpagely → Connect & settings** and press **Connect to Frontpagely**.
   Sign in to Frontpagely if asked, pick your business (it is pre-selected when
   its website matches this site) and press **Approve**. You land back here,
   connected, with both checks run. No keys to copy.
4. Prefer to do it by hand? Open **Connect by hand instead** on the same card:
   make a site key here and paste it into Frontpagely > Connections, then paste
   the tracked entity id and plugin key from there.
5. Turn on the features you want (all are off by default). **Test connection**
   checks both directions and explains anything that is off in plain words.

== Frequently Asked Questions ==

= Do I need a Frontpagely account? =

Yes. The plugin is the WordPress connector for the Frontpagely service. Without
an account and a connected site it stays idle and changes nothing.

= Will this delete my posts if I uninstall it? =

No. Uninstalling never deletes posts. It removes the plugin's tables, options,
and `_frontpagely_*` post meta only if you opted in with the "On uninstall" setting.

= Does it conflict with Yoast SEO or Rank Math? =

No. It detects them and defers meta and schema output to them, adding tags only
where they leave a gap.

= Can Frontpagely change my site without my permission? =

No. Fix application is off until you enable the master permission and each fix
type under **Frontpagely → Settings**. Every applied fix is logged with the exact
before state and can be reverted with one click.

= What happens if someone edits a Frontpagely-published post by hand? =

The post is marked as edited by a person. An automated write that does not match
the current revision is rejected with a 412 conflict instead of overwriting it.

= Does the plugin call ChatGPT or other AI services from my server? =

No. Measurement happens on Frontpagely's servers. Your site only receives
articles and fixes, and reads your scores back from the Frontpagely API.

== Screenshots ==

1. SeenRate: the score with its confidence, the trend, per-engine scores, and your top fixes.
2. The dashboard widget with your SeenRate, its change since the last run, and a link to your fix plan.
3. Connect: one Connect to Frontpagely button, then the business it is connected to and both checks.
4. Features and fix permissions as switches, and the change log with Revert.

== Changelog ==

= 1.4.1 =
* The admin header and the SeenRate empty state show the current Frontpagely mark (three bars on the indigo square), the same mark as frontpagely.com, the app and the plugin directory icon.

= 1.4.0 =
* All plugin names now use the full frontpagely_ prefix (functions, classes, constants, options, tables, post meta and hooks). Existing settings, tables and post meta move over automatically on the first load after the update.
* Redirect changes through the Frontpagely API now need both "Allow approved fixes" and the redirect fix permission, like every other fix.
* The /sitemap.xml alias and the robots.txt Sitemap line use the core sitemap URL from WordPress, so they also work with plain permalinks.
* The request path is sanitized before use.

= 1.3.2 =
* Articles Frontpagely publishes now carry an author: the admin who connected the site (while that user can still publish posts). Before, they were saved with no author, so themes showed no byline and the Article schema had no author.

= 1.3.1 =
* Disconnect: a Disconnect button next to Reconnect on Connect & settings. It tells Frontpagely to drop this site and revoke the plugin key, then forgets both keys and the business here. Feature switches, fix permissions and the change log (with Revert) are kept.
* Disconnecting the site from Frontpagely Connections now also ends the plugin key, so the SeenRate panel never looks connected to a site Frontpagely no longer publishes to.

= 1.3.0 =
* One-click connect: press Connect to Frontpagely, approve the business in Frontpagely, and come back connected. The site key and the plugin key are exchanged server to server; nothing to copy or paste.
* Fixed: the SeenRate panel and Test connection now read with the plugin key from Frontpagely (frontpagely_live_pk_…). Before, it was sent to the wrong endpoint and failed with "missing the entities:read scope".
* Connecting by hand is still available under Connect by hand instead.

= 1.2.0 =
* New admin design in Frontpagely's look, still WordPress-native: works with every admin color scheme, the keyboard and screen readers, and at phone width.
* Connect card: a two-step checklist with a live state for each key, copy buttons, the new site key shown once in a clear box, direct links to Frontpagely Connections, and Test connection results in plain words.
* Step 1 now shows "Connected" once Frontpagely has called the site with the current key.
* SeenRate page: score, confidence, change since the last run, trend and per-engine scores as cards, plus your top fixes and a link to the fix plan; a friendly empty state before connecting.
* Features and fix permissions are switches with one sentence each on what they change, grouped, with the master permission on top and notes on what defers to Yoast SEO or Rank Math.
* Plugin keys (pk_) from Frontpagely Connections now work for the SeenRate widget.
* The change log uses plain labels and keeps one-click Revert.

= 1.1.0 =
* Added dry-run, apply, verification receipt, and rollback routes for eight remediation kinds.
* Added site-side apply permissions, a durable apply ledger, human-edit protection, and one-click admin reverts.
* Hardened database queries (identifier placeholders) and request input handling for WordPress.org review.

= 1.0.0 =
* Initial release: SiteAdapter REST contract, SEO edits, and the SeenRate admin surface.

== Upgrade Notice ==

= 1.4.1 =
Updates the Frontpagely logo in the plugin screens. Settings are kept.

= 1.4.0 =
Renames stored data to the frontpagely_ prefix (moved automatically) and gates redirect changes behind the fix permissions. Settings are kept.

= 1.3.2 =
New articles get the connecting admin as their author. Settings are kept.

= 1.3.1 =
Adds a Disconnect button on Connect & settings. Settings are kept.

= 1.3.0 =
Connect with one click (no keys to copy) and a fix for the SeenRate panel failing with a plugin key. Settings are kept.

= 1.2.0 =
A clearer admin: a two-step Connect checklist, a card-based SeenRate page with top fixes, and switches for every feature. Plugin keys from Frontpagely Connections now work. Settings are kept.

= 1.1.0 =
Adds the disabled-by-default fix application layer and a reversible activity log.

= 1.0.0 =
Initial release.
