# Generate first class citizen pages from your data

You have all that nicely structured content in `yaml` ou `json`, and all you would like is to generate static pages out of it. May that be events, catalog or any type of roq collection really.

However, if it was already possible to declare data using [Roq]({=site.url}) via [roq-data]({=site.url("/docs/basics/")}#data), for which it is even possible to have [strong typing](https://docs.quarkiverse.io/quarkus-roq/dev/quarkus-roq-data.html#data_mapping), it was not possible to extract pages directly from them. One could create pages *by hand* that used the data, or, as [Stéphane Philippart](https://philippart-s.github.io/blog/) did, generate pages programmatically from these...

The first solution is useful if you only want a single page containing all the content. This is the case, for example, in this blog for  [the list of events]({=site.url("events/")}) that I gave. However, it is not possible to send a specific link to a particular talk.

Since Roq  [version 2.1]({=site.url("/posts/roq-2-1-is-here/")}), it is possible to automatically generate a page for each collection item simply by declaring it.

In the configuration file we just need to add:

**application.properties**

```
site.collections.events.layout=event <1>
site.collections.events.from-data.id-key=id <2>
```

1. Every collection item will be rendered using the `events` layout, which source can be found under \<root_dir> templates layouts events.html.
2. The property name to be used as *identifiant*

In this case one item of this collection would be found under the `\https://iamroq.dev/events/<slugified form of the title>`.

And that's all. There is NOTHING else to do. Ok, maybe the *layout* is still work to do. Ok. A minor peculiarity, for the moment item will be made available for the templating through the page `data`, even you have specified `@DataMapping`.

To access it in your ***Qute*** template you will have to use `\{=page.data.title}` (or `\{page.data.title}` if you are not using the alternative expression syntax).

The feature is beeing particularly usefull in this AI era where LLM are so keen to generate structured output.

> [!TIP]
> We do not particularly like generated post, but it can be very usefull for summaries, check <https://devoured.fyi/> that make good use of this feature !!!

Full documentation is [already available]({=site.url("/docs/advanced/")}#collections-from-data).

Illustration by [Lucas Santos](https://unsplash.com/@_staticvoid)
