Ratings

A rating per page and language – shown as a dot on the view button, kept until the next analysis, and available to blueprints and templates.

Every analysis leaves a rating behind: one traffic light for SEO, one for readability, how many results came out good, OK, or bad, the analyzed version, and the time. The plugin keeps one rating per page and language, and one for the site.

Dot on the View Button

The view button carries the rating as a colored dot: green for good, orange for OK, and red for needs improvement. The dot takes the color of the worse of the two lights, so a page with a good SEO light and a bad readability light shows red. Gray means the page has been analyzed but neither category could be scored. A page that was never analyzed shows no dot.

Once the page is published again after the analysis, the rating is stale. The dot then shows an exclamation mark in the color of the rating it no longer stands for. The section marks the same state below its report with "Content changed since". Run the analysis again, or let analyzeOn: publish do it after every publish.

Kirby Panel

Our Studio

Who Stores a Rating

An analysis stores its rating when the editor may update the page. An editor whose role can preview but not update still runs the analysis and sees the report and the dot, but nothing is stored for others.

Page Method

The seoAuditRating() method returns the rating of a page in the current language, and $site->seoAuditRating() the site's. Used as a string, the rating reads as its worse light: good, ok, or bad. A page that was never analyzed reads as an empty string.

site/templates/default.php
<?php if ($page->seoAuditRating()->isStale()): ?>
  <p>The SEO rating of this page is stale.</p>
<?php endif ?>
MethodReturns
seo()The SEO light, none when it could not be scored, empty when there were no results or before the first analysis
readability()The readability light, none when it could not be scored, empty when there were no results or before the first analysis
score()The rating as a number: 0 unrated, 1 bad, 2 OK, and 3 good
isStale()Whether the page was published since the analysis
timestamp()When the analysis ran, as a UNIX timestamp, null before the first analysis
version()The analyzed content version, latest or changes, empty before the first analysis
counts()How many results were good, OK, and bad

In Blueprints

The rating works in Kirby queries, so a pages section can show it per page. To sort by it, use seoAuditScore, the rating's score():

sections/articles.yml
type: pages
info: "{{ page.seoAuditRating }}"
sortBy: seoAuditScore asc

Sorted ascending, pages without a rating come first, followed by the ones that need work.

Only pages that have been analyzed carry a rating. To rate every page of a site, an editor has to open each one and run the analysis, or publish it with analyzeOn: publish enabled.

Where Ratings Live

Ratings are stored in the plugin's cache, not in the content files, so an analysis never counts as a content change. Clearing the cache removes the ratings; the next analysis of a page restores its rating. Deleting a page removes its ratings. On a site without UUIDs, moving or renaming a page loses its ratings.