lektor-website/content/docs/api/db/query/first/contents.lr

21 lines
397 B
Plaintext
Raw Normal View History

2015-12-19 14:52:17 +01:00
title: first
---
summary: Returns the first matching record.
---
type: method
---
body:
This method returns the first [Record :ref](../../record/) that matches the
query. If no such record can be produced, `None` is returned.
## Example
```html+jinja
{% first_visible = this.children.first() %}
{% if first_visible %}
<h2>Explore More ...</h2>
<p>{{ first_visible.title }}
{% endif %}
```