Routing
Inlay registers no routes on its own. inlay:install adds these to routes/web.php:
Inlay::adminRoutes(); // the admin, under config('inlay.admin.prefix')
Inlay::previewLinkRoutes(); // signed preview links, see MCP server
// ...your own routes...
Inlay::pageRoutes(); // published pages - always last
Inlay::routes() registers adminRoutes() and pageRoutes() together.
You can serve pages through Inlay::pageRoutes(), through your own routes with <x-inlay::render> (see Publishing and rendering), or both.
Root and prefixed pages
Inlay::pageRoutes(); // / is the homepage, /about is path "about"
Inlay::pageRoutes(prefix: 'pages'); // /pages is the homepage, /pages/about is path "about"
Arguments override config('inlay.pages.prefix'), pages.view and pages.middleware. 'pages', '/pages' and 'pages/' are equivalent.
A page's stored path is bare - about/team, never a leading slash, host or prefix. Changing the prefix moves every page without touching the database. Nested paths work as you'd expect.
Register it last
At the root, Inlay::pageRoutes() is a catch-all. Laravel answers a request with the first route that matches, so:
- a route registered before it that matches a page's URL wins, and the page never shows
- a route registered after it never gets a request
A prefixed registration only matches under its prefix, so ordering matters less.
Route conflicts
Inlay asks the router which route really answers each page's URL:
- The editor shows a warning on a page whose URL another route answers, naming that route.
php artisan inlay:doctorfails when any page is hidden by another route, and whenInlay::pageRoutes()was registered before parameterless routes it then hides. Only routes without parameters are checked for the second case.
Fix it by removing or renaming the other route, giving the page another path, or moving Inlay::pageRoutes() to the end of routes/web.php.
The homepage
One page at a time can be the homepage, set in Page settings. It resolves at the route group's root. Setting a new homepage replaces the old one. A homepage that isn't published is a 404 like any other draft.
What resolves
Only published pages resolve. A draft, or a page with no path that isn't the homepage, returns a normal 404.
The public view
Inlay::pageRoutes(view: 'inlay.pages.show'); // the default
The view receives $page, $composition (an Htmlable to echo) and $context (null here). It owns the layout, CSS, JavaScript and <head>:
<title>{{ $page->effectiveMetaTitle() }}</title>
@if ($page->effectiveMetaDescription())
<meta name="description" content="{{ $page->effectiveMetaDescription() }}">
@endif
effectiveMetaTitle() falls back to the page title; effectiveMetaDescription() is null when none is set. A missing view throws an exception naming it.
Title and meta fields are revisioned with the content. path and homepage status take effect immediately, without a publish.
Inlay::url()
Inlay::url($page); // '/pages/about', '/pages' for the homepage, or null
Built from live configuration, so it works in queue workers and commands that never registered the routes.
Calling pageRoutes() twice with the same configuration is ignored; with different configuration it throws.
Route names
Public pages: inlay.pages.show. Admin: inlay.admin.*, for example inlay.admin.pages.index. Preview links: inlay.preview-link.