lektor-website/content/docs/api/db/obj/is-discoverable/contents.lr

33 lines
1.1 KiB
Plaintext
Raw Normal View History

2015-12-26 00:35:25 +01:00
title: is_discoverable
---
summary: Indicates that a record can be discovered via .children
---
type: property
---
version_added: 2.0
---
body:
Records can be discoverable or non discoverable. This is controlled by the
2018-04-21 00:34:30 +02:00
`_discoverable` system field which defaults to `yes`. This property can quickly
2015-12-26 00:35:25 +01:00
check if a record is considered non-discoverable by Lektor or not. In
particular a hidden record is also considered undiscoverable.
Undiscoverable records can be queried and final pages will be built but they
are exempt from queries of the record. This is useful for pages that should
2015-12-26 00:35:25 +01:00
be built but not show up yet on overview pages. For instance this can be used
to implement drafts of blog posts or similar things.
This property is implemented on the level of source objects to make it
possible to use this API in all cases. The default implementation of
source objects will always return `true` for discoverability checks.
## Example
```html+jinja
{% set downloads = site.get('/downloads') %}
{% if downloads.is_discoverable %}
<p><a href="{{ downloads|url }}">Go to downloads</a>
{% endif %}
```