---
title: "getAllSlugs"
description: "List every slug without reading content."
canonical: "https://www.qino.works/docs/api/collection/get-all-slugs"
---

# getAllSlugs

> List every slug without reading content.

Lists the filenames in the collection directory, strips the extension, and sorts them. Nothing is read or validated.

```ts title="src/app/posts/[slug]/page.tsx"
const slugs = await postCollection.getAllSlugs();
// ["hello-world", "second-post"]
```

## Signature

```ts title="@qino/cms"
collection.getAllSlugs(): Promise<Array<Slug>>;
```

## Parameters

None.

## Returns

`Promise<Array<Slug>>`, sorted with `.sort()`. After `qino build`, `Slug` is the generated union for this directory; before, it is `string`.

## Behavior

- Discovers `*<extension>` at the top level only. Nested and hidden files are excluded.
- Never reads content, validates schemas, resolves relations, or runs view callbacks.
- Includes slugs whose content is malformed or invalid.
- Returns `[]` for an empty or missing directory.

Because views are ignored, the list can contain slugs that a filtering default view excludes, and [getEntry](https://www.qino.works/docs/api/collection/get-entry) throws for those. Use `getAllSlugs` for routes when the default view has no `filter`. Otherwise derive slugs from the viewed set:

```ts title="src/app/posts/[slug]/page.tsx"
const slugs = (await postCollection.getEntries()).map(
  (post) => post._meta.slug,
);
```

## Throws

Nothing beyond filesystem errors.

## Example

```ts title="src/app/posts/[slug]/page.tsx"
export async function generateStaticParams() {
  const slugs = await postCollection.getAllSlugs();
  return slugs.map((slug) => ({ slug }));
}
```
