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
| Settings | Where | Applies to |
|---|---|---|
| Per post | The SEO 設定 fields on the edit screen | That page or post |
| Per page | seo in settings/pages.php | That page |
| Per archive | seo in settings/post-types/*.php | The archive, or every term of a taxonomy |
| Site-wide | settings/seo.php | Every 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.