# Read a page category in a template

Source: https://zotonic.com/cookbook/1587/read-a-page-category-in-a-template

URI: https://zotonic.com/id/1587

Language: en

Use the current resource rather than parsing its URL.

The page controller supplies `id`. Resolve its category directly:

```django
{% with id.category_id as category_id %}
    <p>{{ category_id.title }}</p>
{% endwith %}
```

Use `id.is_a.article` for an inherited category test, replacing `article` with your category's name. To select category-specific rendering, prefer <a href="/id/1325" class="doc-reference doc-reference-tag"><code>tag#catinclude</code></a> over a long chain of category conditions.

A page URL is not a reliable category identifier: custom paths, language prefixes and dispatch rules can change its shape. For a value from a request, resolve it through `m.rsc[value].id` and handle a missing resource before reading properties.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1587?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1587?language=en>)
