Your own title format with Stati's SEO tags

Write the <title> yourself and let Stati fill in the rest of the head.

SNP 081 #152 Filed stati seo

eta
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><%= stati.page.title ? `${stati.page.title} · ${stati.site.title}` : stati.site.title %></title>
</head>

Stati adds its SEO tags just before </head>, but only the kinds the page doesn't have yet. With a <title> of your own, the title keeps your format, and Stati still writes the description, the canonical link, and the Open Graph and Twitter tags. The <title> it would write is the page title alone, so a "Page · Site" format has to come from the layout.

Open Graph and Twitter tags go as groups. Write one og: tag by hand and Stati leaves out all of its Open Graph tags; the same goes for twitter:. To change one of those, set it in the page's front matter instead:

yaml
seo:
  openGraph:
    title: A longer title, only for link previews
  twitter:
    creator: '@me'

A layout without a </head> gets no tags at all, so a hand-rolled head without the closing tag quietly loses its SEO.

In the Stati docs: Hybrid mode, Tag groups and How do I override specific tags?