Skip to main content

SEO

The title, meta description, OGP, JSON-LD and sitemap are output by TONKATSU. Don't install another SEO plugin such as Rank Math.

Site-wide settings​

Write the site-wide settings in settings/seo.php, which returns a SiteConfig.

// settings/seo.php
return new SiteConfig(
separator: '|',
includeParentTitles: true, // Include parent page titles in child page titles
defaultDescription: 'サイトの説明文',
defaultOgImage: get_theme_file_uri('data/img/ogp.png'),
sitemap: new SitemapConfig(excludeProviders: ['users']),
);

Per page and per post​

SettingsWhereApplies to
Per postThe SEO 設定 fields on the edit screenThat page or post
Per pageseo in settings/pages.phpThat page
Per archiveseo in settings/post-types/*.phpThe archive, or every term of a taxonomy
Site-widesettings/seo.phpEvery page

A setting higher in the table takes priority. Editors can override the title, description, OGP image and noindex of each page and post on its edit screen (settings/fields/seo.php).

// settings/pages.php
'contact/result' => [
'title' => '送信完了',
'seo' => ['noindex' => true],
],

Checking the settings​

  • Tools → SEO (TONKATSU) shows the settings in effect, and the Pages screen has SEO columns.
  • While Settings → Reading → Discourage search engines from indexing this site is on, those screens show a warning. Check it before the site goes live.

See the TONKATSU documentation for the details.