Skip to main content

Rule packs

Head fixes as rules, on your own server

A rule pack is a JSON file of rules for the head of your pages: canonical, title, description, hreflang and JSON-LD. mod_pagespeed applies them to the HTML it serves, with no CMS change. A pack starts in report mode: the server logs what each rule would change and changes nothing. You switch to enforce mode per site and per rule when the log shows what you expect.

Three switches before a pack changes HTML

  • The server turns the rule_packs filter on and names the pack file. It is off by default.
  • The site is listed in the pack in report mode or in enforce mode.
  • The rule is set to enforce. A rule that is not stays in report mode.

Each pack names its publisher and version. When the server loads a pack it logs the pack's id, version and SHA-256 hash, so you can see which pack, and which version of it, is running.

Free · available with the next release

Edge SEO

Canonical, title, description, hreflang and JSON-LD hygiene at the origin. Rules match URL paths and set each element from a table or a template, so one rule fixes every page it matches. No CDN and no CMS release needed.

Where to get it

Your rules

Write your own

A pack is a plain JSON file. Write one for your own sites in the same format, and run it in report mode until the log shows what you expect.

The pack format

Planned: script control at the origin

Planned

Payment-page script integrity

PCI DSS 4.0 (requirement 6.4.3) asks payment pages to keep an inventory of the scripts they load and to authorise each one; requirement 11.6.1 asks for detection of unauthorised changes to those pages. We are building a server module that keeps a list of approved scripts at your origin.

Tell us what you run.

We use what you send to reply and to email you when there is a build to try. See the privacy policy.

Planned

Third-party freeze

A third-party script that loads without an integrity hash can change upstream without notice. We are building a way to serve each one at a version you approved until you accept the update.

Tell us what you run.

We use what you send to reply and to email you when there is a build to try. See the privacy policy.

Get the edge-SEO pack

The edge-SEO pack is free. It will be downloadable from the packs directory of the pagespeed-optimizer repository, together with the operator guide, with the next release. Until then that directory holds an example pack and the test fixtures the rules are checked against.

The pack format

  • One JSON file: the pack name, version and publisher, the sites it applies to, lookup tables and the rules.
  • Each rule names a kind (canonical, title, description, hreflang or JSON-LD), the paths it matches and the value it sets, from a table or a template.
  • Each rule says what to do when the page already has the element: keep it, repair it or replace it.
  • Your own packs use the same format, the same report mode and the same opt-in as the packs we publish.

An example pack shows every part. The operator guide, with the full reference, ships with the next release.

Updates
Packs we curate will come with updates you pull when you choose; the server never phones home.

Other directions we are exploring are on the transform packs page.

Search