is_discoverable
Records can be discoverable or non discoverable. This is controlled by the
_discoverable
system field which defaults to `yes. This property can quickly
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 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.
{% set downloads = site.get('/downloads') %}
{% if downloads.is_discoverable %}
<p><a href="{{ downloads|url }}">Go to downloads</a>
{% endif %}
Comments