Skip to content
duxt

Collections

What Content builds from the sources, and the four things the schema adds.

A collection is Content's unit of sourcing: a glob, a place to read it from, and a schema. duxt declares one per repository × ref, so a site with one folder has one collection and a site with two repositories at three refs has six.

Their names are data, not a constant. A site with two repositories has docs_duxt and docs_workflows and no collection called docs at all — which is why the theme reads the collection name out of the manifest rather than hard-coding one, and why a query of your own should do the same:

<script setup lang="ts">
const { collection } = useDuxtCollection();
const { data } = await useAsyncData(() =>
  queryCollection(collection.value).all()
);
</script>

What the schema adds

Content stores only what a schema declares, so four things the theme needs are declared explicitly. The full list is in the frontmatter reference; the reasons are here:

  • icon, layout, navigation — theme fields. Without the schema an icon: in frontmatter is silently dropped before the sidebar ever sees it.
  • rawbody — the Markdown as written. Two things need it: the button that hands a page to a model, and llms-full.txt.
  • redirectFrom — turned into route rules by the build; see Move a page.
  • sitemap — what puts these pages in the sitemap at all. A collection has to declare the field, or the sitemap lists the site's routes and not one documentation page.

Partials

_partials/ in any source's docs folder feeds one shared collection, and :partial{name="install"} in any page of any source renders it. Content ships no include directive, and across several repositories that gap has no workaround at all — an install note that has to read the same in three projects gets copied into three projects and drifts.

Partials carry the same language dimension the pages do: docs/_partials/ is duxt_partials, docs/de/_partials/ is duxt_partials_de, and :partial walks the same fallback chain the page it sits in walked. It has to be the same chain — a page and the blocks it includes falling back to different languages is how a page ends up half translated with nothing on it saying so.

Partials are excluded from the page collections themselves. Otherwise every partial would also be a page: in the sidebar, in the search, in llms.txt.

Drafts are files, not flags

A draft is deploying.draft.md, not draft: true in frontmatter. The flag is the obvious spelling and the one that cannot work: a collection's contents are declared before Content has read a single file — for a remote source, before it has been downloaded — so nothing at that point knows what any frontmatter says. A file name is known. Content strips .draft from the URL, so the page is served at /deploying in the dev server and is simply absent from the build.

Was this page helpful?