# Nuxt Layouts and Pages
> Structure applications with file-based routing, named layouts, and per-page configuration via definePageMeta
## When to Use
- You are building out the route structure of a Nuxt application
- You need multiple layouts (default, auth, dashboard) with different navigation or sidebar configurations
- You want to configure page-level metadata, transitions, middleware, or keepAlive from within the page SFC
- You are implementing nested routes or catch-all pages
## Instructions
**Pages — file-based routing:**
1. Create `.vue` files in `pages/` — the path maps directly to the URL route:
```
pages/
index.vue → /
about.vue → /about
users/
index.vue → /users
[id].vue → /users/:id
[...slug].vue → /* (catch-all)
```
2. Place `` in `app.vue` (or within a layout) to render the active page:
```html
```
3. Access route params with `useRoute`:
```typescript
const route = useRoute();
const id = route.params.id; // typed if using typed routes
```
**Layouts:**
4. Create layouts in `layouts/`. The `default.vue` layout is applied automatically. Named layouts require explicit opt-in:
```html
```
```html
```
5. Apply a named layout from a page using `definePageMeta`:
```typescript
// pages/admin/users.vue
```
6. Disable the layout entirely for specific pages (e.g., a full-screen login page):
```typescript
definePageMeta({ layout: false });
```
7. Switch layouts dynamically at runtime using `setPageLayout`:
```typescript
const { setPageLayout } = useLayout();
setPageLayout('minimal');
```
**definePageMeta — per-page configuration:**
8. Use `definePageMeta` for all page-level config — it is a compiler macro and must be called at the top level of `