Lapis Docs

Building a site

SEO

Lapis writes what search engines and social sites read: the title, the description, the canonical address, Open Graph tags and structured data. It takes them from the page's own data and the global settings, and editors fill in the rest in the Page panel. On top of that, Lapis keeps a sitemap, redirects moved pages and makes a sharing image for every page.

In the page head

Put <x-seo /> into the <head> of your layout:

<head>
    <meta charset="utf-8">
    <x-seo :title="$title" />
    <x-importmap />
</head>

It writes the title, the description, the canonical address, the robots tag, and the Open Graph and Twitter tags. title, description and image can be overridden with attributes.

Structured data

<x-seo /> also writes JSON-LD:

  • on the home page, WebSite and Organization, from the settings,
  • on subpages, a BreadcrumbList,
  • on posts (the page types listed in articleTypes), a BlogPosting.

To describe the site as a different schema.org type, set it in the config:

// lapis.config.php
use Lapis\Seo\SchemaOrg;

schema: new SchemaOrg(
    type: 'LocalBusiness',
    properties: ['name' => 'site_name', 'telephone' => 'phone'],
    extra: ['priceRange' => '€€'],
),

By default, SchemaOrg maps name, telephone, email, address, logo and image from the settings site_name, phone, email, address, logo and og_image. Passing properties: replaces that map (keep 'name', because the block is only written when name has a value), and extra: adds fixed values.

Per page

In the Page panel, under "Search engines and sharing", editors set an SEO title, a sharing title and text, the canonical address, noindex and nofollow, and whether the page is left out of the sitemap.

Addresses, sitemap, robots

Absolute URLs are only built from BASE_URI in .env. Without it, they stay relative.

/sitemap.xml lists the public pages, without hidden, noindex, excluded and middleware-protected pages.

/robots.txt disallows everything outside production. In production, you may add your own lines:

// lapis.config.php
robots: ['Disallow: /search'],

Redirects

When a page's path changes, the old address answers with a 301 to the new one, by itself. Manual redirects and the 404 log, with suggestions for each missing address, are in the toolbar under SEO.

Sharing image, IndexNow, checks

Sharing image

When a page has no sharing image of its own, Lapis makes one: a 1200×630 PNG with the page's title. Set its colours, or switch it off, in the config:

// lapis.config.php
ogImage: new OgImageStyle(background: '#23398c', color: '#eef1fc', accent: '#9fb0f3'),
// or: ogImage: false,

IndexNow

On publishing, Lapis sends the changed pages to search engines with IndexNow. This only happens in production, with an HTTPS BASE_URI. To switch it off, set indexNow: false.

Checks

The SEO panel's "This page" tab checks the length of the title and the description, a single h1, the order of the headings, images without alt text, the JSON-LD and duplicate titles.