Product registry
List your products once in publier.config.yaml and render the header's product menu, the docs product switcher and your own product pages from that one list.
A site that sells several products tends to list them in several places: the header menu, the documentation product switcher, a products page, a pricing page. Each hand-written copy drifts from the others. The product registry is one list in publier.config.yaml that every one of those renders from. It needs @publier/native 0.17.0 and @publier/shell 0.9.0 or later.
products: categories: - { id: compute, label: Compute } - { id: storage, label: Storage } items: - id: inference name: Inference category: compute description: Open models over one endpoint. href: /products/inference docs: /docs/inference aliases: [llm, models] data: pricing: /pricing/inference - id: file-system name: File System category: storage status: soon href: /products - id: buckets name: Buckets category: storage description: Object storage with free egress. href: /products/buckets docs: /docs/buckets status: betaFields
| Field | Meaning |
|---|---|
categories[].id | A stable id: lowercase letters, digits and single hyphens. |
categories[].label | The heading shown for the category. Categories appear in list order; a category with no products is not shown. |
items[].id | The product’s stable id, in the same form. Treat it as permanent once published. |
items[].name | The product’s name. |
items[].category | The id of its category. Each product belongs to exactly one. |
items[].description | One line: what the product is. Shown under the name in menus. |
items[].href | The product’s own page. Menus link here, or to docs when it is absent. |
items[].docs | The product’s documentation root, such as /docs/buckets. |
items[].tabs | The section links of the product’s documentation header, in the shape of a docs product’s tabs: { label, href } links, and { label, sdk } for a generated SDK reference. Needs docs. Absent inherits the variant’s tabs, and [] shows none. |
items[].icon | A local path or https URL of a small image shown beside the name in menus. |
items[].aliases | Other words for the product. The menu filter matches them; they are not shown. |
items[].status | ga (the default, no badge), beta, preview or soon. The last three show a badge: Beta, Preview, Coming soon. |
items[].featured | true marks a product as featured, for your own pages. |
items[].data | Any fields of your own, passed through untouched to your pages. |
Products appear in list order within their category. A soon product is unreleased: it may be named in a menu with its Coming soon badge, and it cannot have docs. The build fails with the field’s path when an id is malformed or repeated, a category is unknown, a status is not one of the four, two products share a docs root, or a destination is not a safe link.
The header’s product menu
In a navigation group, directory: true lists the registry: one titled section per category, each product with its description, icon and status badge. It needs the mega menu (variants.nav: mega), and works alongside the group’s other fields.
nav: tabs: - label: Products directory: true search: true footer: - { label: All products, href: /products }Any groups the entry also has follow the registry’s sections. With search: true, the filter matches each product’s name, description and aliases, so llm finds Inference.
The rail layout
With many products, layout: rail shows one category at a time beside a vertical list of the category names, the way large cloud consoles do. Hovering, clicking or the arrow keys switch category. The panel opens on a Featured section of the products marked featured: true; featuredLabel renames it.
nav: tabs: - label: Products directory: true layout: rail featuredLabel: Popular search: trueTyping in the filter shows the matches from every category at once, each under its category name, and leaves out the featured copies. On small screens the menu keeps the stacked sections, without the featured copies. layout: rail works on any mega-menu group with sections; mark a hand-written section featured: true to treat it the same way.
Product ids
A product you list by hand under nav.<variant>.products may set an id. It is used for search scope. Use lowercase letters and digits in hyphen-separated runs.
nav: docs: products: - { label: Compute, id: compute-engine, path: /docs/compute }Without id, the id is the path’s segments joined by hyphens, so /docs/compute becomes docs-compute. Ids must be unique: two paths that derive the same id (/docs/a-b and /docs/a/b) fail the build until one sets an explicit id. Products that come from the products: registry use their registry id. A product listed by hand with no id whose path is a registry entry’s docs takes that entry’s id too, so search, the changelog and the deprecation table name the product the same way. An explicit id still wins.
The docs product switcher
In a navigation variant’s products, an entry { directory: true } stands for every registry product that has docs, in registry order, at that position in the list. Each becomes a product whose path is its docs root and whose label is its name.
nav: pathRules: - { path: /docs/**, variant: docs } - { path: /docs, variant: docs } docs: products: - { label: Overview, path: /docs, tabs: [] } - { directory: true }A registry product’s docs root also scopes the documentation sidebar to that product’s pages, the same way a product tab’s destination does.
Tabs for a registry product
The header’s row of section links is per product. A hand-listed product gives tabs beside its path; a registry product gives them on its item, so the registry stays the one place a product is described:
products: items: - id: image name: Image category: compute docs: /docs/image tabs: - { label: Documentation, href: /docs/image } - { label: SDK reference, sdk: phron-image }An sdk tab opens the language of that SDK the reader last chose, and an sdk id that matches no integrations.sdk entry fails the build with the item’s field path.
The switcher as a category rail
A flat list suits a few products. With categories, layout: rail on the directory entry shows the switcher the way large cloud consoles show their product menu: the categories down the left, and the selected category’s products, each with its description and status badge, on the right. The category of the product being read is selected when the menu opens.
nav: docs: products: - { label: Overview, path: /docs, tabs: [] } - { directory: true, layout: rail }A hand-listed entry such as Overview leads the menu on a line of its own above the rail. To list it inside the rail instead, give it a category: the id of an entry in products.categories. It then sits in that category beside the registry’s products. A category used only by hand-listed entries works too, and stays out of the marketing Products menu, which lists registry products only:
products: categories: - { id: get-started, label: Get started } - { id: compute, label: Compute } items: [...]nav: docs: products: - { label: Overview, path: /docs, tabs: [], category: get-started } - { label: Product list, path: /products, tabs: [], category: get-started } - { directory: true, layout: rail }A category that names no products.categories entry fails the build. Categories with nothing in them are left out. On small screens the categories stack as titled sections inside the navigation dialog.
A product directory on a page
<ProductDirectory> renders the registry as a page section: a heading per category over a card per product, with its description, icon and status badge.
import { ProductDirectory } from '@publier/shell/components';
<ProductDirectory />| Prop | Meaning |
|---|---|
link | docs (the default) links each product to its docs root and lists only products that have one, for a docs home page. page links to each product’s own page, else its docs, and also lists soon products that have a page, for an all-products page. |
headingLevel | The category headings’ level, 2 (the default) to 4. |
class | Extra classes on the wrapper. |
filter | true shows a “Filter products” field above the list, false hides it. The default is true when the registry has more than six products. |
Filtering the directory
Typing in the field narrows the list by product name, description and aliases, ignoring case and spaces. Categories with nothing left are hidden, and the list says “No products match” when it is empty. Without JavaScript the full directory shows and the field is hidden.
<ProductDirectory filter={false} />Your own pages
Pages import the registry from virtual:publier-products. Its types are added to your project’s generated types (.astro/types.d.ts) at build and dev start, so the import type-checks without setup.
---import { productCategories, products } from 'virtual:publier-products';
const live = products.filter((product) => product.status !== 'soon');---{productCategories.map((category) => ( <section> <h2>{category.label}</h2> {live .filter((product) => product.category === category.id) .map((product) => <a href={product.href}>{product.name}</a>)} </section>))}products holds every product, soon ones included, in configured order; productCategories holds every category. Fields of your own sit under product.data. The module exists only inside Astro’s build, so astro.config.ts and scripts run outside it read publier.config.yaml themselves.
Changelog and deprecations per product
A changelog entry can name a registry product with product, and the deprecations collection lists products, models and API versions being withdrawn. See Changelog and deprecations.