Skip to content
duxt

useDuxtCollection()

Which collection serves this route.

Signature

const { collection, source, sources } = useDuxtCollection();

Returns

ValueTypeWhat it is
collectionstringThe collection name serving the current route
sourceobjectThe resolved source behind it
sourcesarrayEvery resolved source

Notes

collection is a string, not a literal type — a site collection names are generated from its own sources, so nothing in the layer can name them. Pass it to queryCollection rather than writing 'docs'.

Was this page helpful?