Skip to content

Page Components ​

Introduction ​

For every page, kitloom picks which component of the active theme renders it. The choice is made on the server, in the page stack (the themes module adds a step at Stage::LAYOUT), so it is the same for a Vue theme, a Blade theme and the JSON representation.

A candidate is used only if it exists in the theme — a .vue file in resources/js/Pages for a Vue theme, a template for a Blade theme. Otherwise the next candidate is tried.

Selection rules ​

Posts ​

OrderComponentExample: a book with style wide
1Pages/{Type}/{Style}Pages/Book/wide
2Pages/{Type}/IndexPages/Book/Index
3Pages/Page/IndexPages/Page/Index

{Type} is the post type in StudlyCase — book → Book, case_study → CaseStudy. {Style} is the value of the {type}_style meta of the post (book_style), which lets editors choose a layout per post.

Terms ​

OrderComponentExample: a genre term
1Category/{Taxonomy}/IndexCategory/Genre/Index
2Category/IndexCategory/Index

Authors, search and 404 ​

PageComponent
Author archivePages/Author/Index
Search resultsSearch/Index
Not foundPages/404/Index

Only types that have URLs get pages: WordPress pages, plus post types and taxonomies with a permalink prefix. Anything else — post_tag on a site without tag archives, a taxonomy kept only for relations — gets Pages/404/Index. A theme without Search/Index shows the 404 component for search too.

Blade template names ​

The Blade engine maps a component name to a template name by kebab-casing each segment:

ComponentTemplate
Pages/Post/Indexpages.post.index → resources/views/pages/post/index.blade.php
Pages/CaseStudy/Indexpages.case-study.index
Category/Genre/Indexcategory.genre.index
Pages/404/Indexpages.404.index

What the theme knows about the page ​

The step puts view into the page data — the component and what it renders, enough for a client-side resolver to make the same choice during Inertia navigation:

json
"view": {
    "component": "Pages/Book/Wide",
    "modelType": "post",
    "postType": "book",
    "taxonomy": null,
    "layout": "wide"
}

modelType is post, term, user or search. A term has taxonomy and no postType. Without a theme there is no view at all: nobody picks a component.

Turning it off ​

A site that picks components itself can disable the step and add its own at Stage::LAYOUT:

php
// config/kitloom-themes.php
return [
    'pipeline' => ['register' => false],
];