Skip to content
Search
Search the documentation
Section cards
GitHub
Since 0.29 1 min read

Section cards

A card for each page in a section, kept up to date from the sidebar.

SectionCards lists the pages of a section as cards, each with the page’s title, description and link, in the order the sidebar shows them. It reads the pages from the site, so the list stays right as pages are added, moved or renamed. Here it lists the Getting Started section:

Usage

With no props, it lists the section the page is in, leaving out the page itself. That makes an overview page for a section one line long:

			---
title: Components
section: Components
order: 8
---

Everything you can put in a page.

<SectionCards />
		

The Components page on this site is exactly that.

Another section

section picks a section by name, the way a page names one in its section frontmatter. A nested section is an array.

			<SectionCards section="Getting Started" />
<SectionCards section={['Guides', 'Advanced']} />
		

It lists one level. A section inside the one it lists shows as one card, titled with its name and linking to its first page. A page with no description gets a card with its title only.

For agents

The cards come from the site, not from the page, so agents get them written out as a list of links with each page’s description:

			- [Introduction](/docs/introduction): What Svelte DocSmith is and who it is for.
- [Installation](/docs/installation): Add Svelte DocSmith to a SvelteKit project.
		

For that, section has to be written as a string or an array of strings.

Props

SectionCards
section stringstring[]
The section to list, as a page names it in its section frontmatter: 'Components', or ['Guides', 'Advanced'] for a nested one. Defaults to the page's own section. One level is listed; a subsection is one card.

Was this page helpful?