2015-12-19 14:52:17 +01:00
|
|
|
title: query
|
|
|
|
---
|
|
|
|
summary: Creates a query at a specific path.
|
|
|
|
---
|
|
|
|
type: method
|
|
|
|
---
|
|
|
|
signature: path=None, alt='_primary'
|
|
|
|
---
|
|
|
|
body:
|
|
|
|
|
|
|
|
This is one of the many ways to create a [Query :ref](../../query/) object in
|
|
|
|
Lektor. It creates a query at a specific path and alt. This is an
|
|
|
|
alternative to accessing the children of the [root :ref](../root/) record
|
|
|
|
and will also include hidden pages.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```html+jinja
|
|
|
|
<ul>
|
2016-01-08 14:06:28 +01:00
|
|
|
{% for project in site.query('/projects') %}
|
2016-07-22 17:47:09 +02:00
|
|
|
<li>{{ project.name }}: {{ project.year }}</li>
|
2015-12-19 14:52:17 +01:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
```
|