Hydrogen SEO 0.0.30: Snippet Controls, Primary Category, Link Counts and Image SEO

max-snippet and max-image-preview in robots meta, a primary category picker, link counts with an Orphaned filter, image alt formats, and security fixes.

In this article 8 sections
  1. Snippet and preview controls
  2. Primary category
  3. Internal link counter and orphaned content
  4. Image SEO: alt and title from a format
  5. Import SEO Data
  6. Security fixes
  7. Performance
  8. After updating

Hydrogen SEO 0.0.30 adds four things. Snippet and preview controls put max-snippet, max-image-preview, max-video-preview, nosnippet and noimageindex in the robots meta tag, site-wide and per page. A Primary Category choice in the editor decides which category a post in several uses for its URL, breadcrumbs and schema. An internal link counter shows links out and in for every post on the Posts screen, with a filter for orphaned content. And the automatic image alt and title feature has new image variables and a separate switch for empty alt. Import SEO Data covers the new settings. The release also contains security fixes, listed below, so we recommend updating. Everything here is free and needs no account.

Update from Plugins → Installed Plugins as usual. Unlike the last two releases, this one changes three things without being asked, all described below: the robots meta tag on indexed pages gains three directives, link counting starts in the background, and posts that already have a primary category stored start using it in %category% permalinks.

Snippet and preview controls

Until now the plugin's robots meta tag held the indexing directives and nothing else. It also replaced the tag WordPress prints, so the max-image-preview:large that WordPress adds by itself was not on your pages.

From 0.0.30, every indexed page prints:

index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1

The three new values are the most permissive ones: a text snippet of any length, a large image preview, a video preview of any length. max-image-preview:large is the one with a visible effect. Google's Discover guidance recommends images at least 1,200 pixels wide and lists that setting, or AMP, as what enables large images.

To change the values, open Hydrogen SEO → Robots. A new Snippets & Previews card has five fields:

  • Max snippet length, in characters. -1 is no limit and 0 is no text snippet.
  • Max image preview: None, Standard or Large.
  • Max video preview, in seconds. -1 is no limit and 0 allows a still image only.
  • No snippet: no text snippet or video preview at all.
  • No image index: the page's images are not indexed.

A line under the fields shows the directives your choices will print. For a single post, page or term, open Robots Meta in its SEO Settings sheet and switch off Snippets & previews: use site default to give it values of its own.

Noindex pages never get these directives, and WordPress's Discourage search engines option still overrides everything.

Reference: snippet and preview controls. Background: max-image-preview:large and Google Discover.

Primary category

A post in three categories still has one URL and one breadcrumb trail. With a %category% permalink structure, WordPress puts the category with the lowest ID in the URL, which is rarely a decision anyone made.

Tick two or more categories in the editor and a Primary Category dropdown now appears under the checklist, in the block editor's Categories panel and under the Categories box in the Classic editor. WooCommerce products get the same for product categories. Your choice is used for:

  • the post's URL, when the permalink structure contains %category%
  • the breadcrumb trail and BreadcrumbList schema
  • articleSection in Article schema
  • the %category% variable in titles and descriptions
  • WooCommerce's product URL and its own breadcrumb

Three things to know before you use it:

  • The picker never chooses for you. The dropdown starts at Not set and stays there while you tick and untick categories. If you untick the category that was primary, it goes back to Not set. Posts with no primary category behave exactly as before.
  • Changing it on a published post changes the address on %category% permalinks. The old address is not redirected: it keeps loading with a 200 response, and its canonical tag points to the new address. WordPress redirects a category permalink only when the post is not in the category named in the URL. Links in your own content keep the old address until you edit them.
  • Posts that already have a primary category stored, for example from an import, start using it in %category% permalinks with this update, so on such a site some addresses change. To keep them as they are, return false from the hydrogen_seo_primary_term_in_permalinks filter, which receives a boolean (default true) and the post. Breadcrumbs, schema and the %category% variable keep using the primary category either way.

Reference: primary category. Background: primary category in WordPress: what it changes.

The SEO column on Posts, Pages and custom post type lists has a new line for published posts:

↳ 4 · ↗ 2 · ↙ 3

That reads: 4 internal links out, 2 external links out, 3 posts linking in. A post that no other published post links to shows ↙ 0 in amber, and the All SEO filter has a new option, Orphaned (no internal links in), that lists them all.

Counting is on by default. After the update, existing content is read in the background, 50 posts at a time, and each post is counted again whenever it is saved. Links to the www and the non-www form of your address both count as internal. If the plugin is deactivated and activated again, the count restarts by itself. Until the first pass finishes, rows show Links not counted yet and the Orphaned list carries a notice that it may be incomplete. On large sites, wp hydrogen-seo links recount does the whole count at once.

Two things to know when reading the numbers:

  • Links are those written into post content. Menus, widgets, footers and archive listings are not counted, so an "orphaned" post may still be reachable through a category page. What it lacks is a link from the text of another post.
  • The links are kept in a new database table, and the counts in post meta. Deleting the plugin removes both. The switch is Count Internal Links under Hydrogen SEO → General → Links, with a Recount links button beside the progress line, if you would rather not have it.

Reference: internal link counter and orphaned content. Background: orphan pages in WordPress: how to find and fix them.

Image SEO: alt and title from a format

Add Missing ALT Attributes and Add Missing TITLE Attributes, under Hydrogen SEO → General → Images, have been rebuilt. Both remain off by default and work only on the pages visitors load; nothing is written to the Media Library.

  • Four image variables in the picker: %image_title% (the Media Library title, or the file name read as words), %filename%, %post_title% and %site_name%. The default format for both attributes is now %image_title%, so pour-over-coffee-1024x683.jpg produces "Pour over coffee".
  • Also Fill Empty Alt is a separate switch. An empty alt="" is how a decorative image is marked, so it is now left alone unless you ask otherwise. Sites that already had Add Missing ALT Attributes on keep the old behaviour until they save the new switch.
  • Images marked as decorative never get alt text: no alt is generated for an image with role="presentation", role="none" or aria-hidden="true".
  • Featured, gallery and shop images are covered as well as images in post content.
  • A format you saved earlier keeps working: %title% in an alt format still prints the post title, and common variables such as the separator, the tagline, the author name and the category are still filled in. A format that prints nothing for an image falls back to the default.

Reference: image SEO: automatic alt and title attributes.

Import SEO Data

The importer under Tools now also brings across:

  • Snippet and preview directives, site-wide and per post, where the previous plugin had them. Values it held per post type or per taxonomy are listed in the report, since Hydrogen SEO sets them site-wide and per page.
  • Image alt and title formats, converted to the four image variables, with Also Fill Empty Alt switched on when the previous plugin filled empty alt too.

The preview lists every value before anything is saved, and Undo restores what you had. See the import guide.

Security fixes

This release fixes the following, and we recommend updating:

  • With Nofollow External Links or Open External Links in New Tab/Window switched on, a crafted link attribute in a post written by a Contributor could become a script attribute when the link was rewritten. Links are now rewritten without that being possible.
  • SEO fields can no longer be set through the Custom Fields panel by users who cannot open the SEO settings.
  • JSON-LD output now escapes angle brackets.

Performance

The robots directives and the primary category add no database query to any page. Link counting does its work when a post is saved and in the background, never while a page is served; saving a post whose links did not change costs one query. The image feature attaches no code at all while both switches are off.

After updating

  1. Look at one page's source and confirm the robots tag reads as you expect. If you had deliberately limited snippets or image previews some other way, set the same limits on the Robots screen.
  2. Let the link count finish, then open Posts with the Orphaned filter and link to the posts worth keeping.
  3. Set a primary category on new posts that sit in more than one category. Leave established posts alone unless the current category is wrong. If you imported primary categories from another plugin and use %category% permalinks, check a few of those posts' addresses after updating.
  4. Decide on image attributes. If your file names are descriptive and alt text was rarely written, switching on Add Missing ALT Attributes with Also Fill Empty Alt is a reasonable stopgap while real alt text is written.