Document new get_siblings() method.
get_prev_sibling and get_next_sibling removed in https://github.com/lektor/lektor/pull/118
This commit is contained in:
parent
ff03293abc
commit
0dc29c6bae
|
@ -1,24 +0,0 @@
|
||||||
title: get_next_sibling
|
|
||||||
---
|
|
||||||
summary: Returns the next record.
|
|
||||||
---
|
|
||||||
type: method
|
|
||||||
---
|
|
||||||
body:
|
|
||||||
|
|
||||||
Get the next record in this record's parent's list of children.
|
|
||||||
|
|
||||||
If the parent record has pagination enabled, then `get_prev_sibling` and
|
|
||||||
`get_next_sibling` use the pagination query to filter and order the children.
|
|
||||||
Otherwise, the parent's standard configuration for children is used.
|
|
||||||
See [the pagination guide :ref](../../../../guides/pagination/) and the
|
|
||||||
[page order guide :ref](../../../../guides/page-order/).
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```html+jinja
|
|
||||||
{% set newer = this.get_next_sibling() %}
|
|
||||||
{% if newer %}
|
|
||||||
<a href="{{ newer|url }}">Next article: {{ newer.title }}</a>
|
|
||||||
{% endif %}
|
|
||||||
```
|
|
|
@ -1,24 +0,0 @@
|
||||||
title: get_prev_sibling
|
|
||||||
---
|
|
||||||
summary: Returns the previous record.
|
|
||||||
---
|
|
||||||
type: method
|
|
||||||
---
|
|
||||||
body:
|
|
||||||
|
|
||||||
Get the previous record in this record's parent's list of children.
|
|
||||||
|
|
||||||
If the parent record has pagination enabled, then `get_prev_sibling` and
|
|
||||||
`get_next_sibling` use the pagination query to filter and order the children.
|
|
||||||
Otherwise, the parent's standard configuration for children is used.
|
|
||||||
See [the pagination guide :ref](../../../../guides/pagination/) and the
|
|
||||||
[page order guide :ref](../../../../guides/page-order/).
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```html+jinja
|
|
||||||
{% set older = this.get_prev_sibling() %}
|
|
||||||
{% if older %}
|
|
||||||
<a href="{{ older|url }}">Previous article: {{ older.title }}</a>
|
|
||||||
{% endif %}
|
|
||||||
```
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
title: get_siblings
|
||||||
|
---
|
||||||
|
summary: The previous and next children of this page's parent.
|
||||||
|
---
|
||||||
|
type: method
|
||||||
|
---
|
||||||
|
body:
|
||||||
|
|
||||||
|
Get the previous and next record in this record's parent's list of children.
|
||||||
|
|
||||||
|
The returned object has attributes `prev_page` and `next_page`.
|
||||||
|
Each can be a [Record :ref](../) or `None`.
|
||||||
|
|
||||||
|
If the parent record has pagination enabled, then use the pagination query to
|
||||||
|
filter and order the children. Otherwise, the parent's standard configuration
|
||||||
|
for children is used.
|
||||||
|
See [the pagination guide :ref](../../../../guides/pagination/) and the
|
||||||
|
[page order guide :ref](../../../../guides/page-order/).
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```html+jinja
|
||||||
|
{% set siblings = this.get_siblings() %}
|
||||||
|
|
||||||
|
{% if siblings.prev_page %}
|
||||||
|
<a href="{{ siblings.prev_page|url }}">previous</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if siblings.next_page %}
|
||||||
|
<a href="{{ siblings.next_page|url }}">next</a>
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
|
||||||
|
See also: [has_prev :ref](../has_prev/) and [has_next :ref](../has_next/).
|
|
@ -0,0 +1,27 @@
|
||||||
|
title: has_next
|
||||||
|
---
|
||||||
|
summary: Whether the record has a next sibling.
|
||||||
|
---
|
||||||
|
type: method
|
||||||
|
---
|
||||||
|
body:
|
||||||
|
|
||||||
|
True if there is a next record in the parent's list of children.
|
||||||
|
|
||||||
|
If the parent record has pagination enabled, then use the pagination query to
|
||||||
|
filter and order the children. Otherwise, the parent's standard configuration
|
||||||
|
for children is used.
|
||||||
|
See [the pagination guide :ref](../../../../guides/pagination/) and the
|
||||||
|
[page order guide :ref](../../../../guides/page-order/).
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```html+jinja
|
||||||
|
{% if this.has_next() %}
|
||||||
|
<a href="{{ this.get_siblings().next_page|url }}">next</a>
|
||||||
|
{% else %}
|
||||||
|
<p>This is the last entry.
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
|
||||||
|
See also: [has_prev :ref](../has_prev/) and [get_siblings :ref](../get_siblings/).
|
|
@ -0,0 +1,27 @@
|
||||||
|
title: has_prev
|
||||||
|
---
|
||||||
|
summary: Whether the record has a previous sibling.
|
||||||
|
---
|
||||||
|
type: method
|
||||||
|
---
|
||||||
|
body:
|
||||||
|
|
||||||
|
True if there is a previous record in the parent's list of children.
|
||||||
|
|
||||||
|
If the parent record has pagination enabled, then use the pagination query to
|
||||||
|
filter and order the children. Otherwise, the parent's standard configuration
|
||||||
|
for children is used.
|
||||||
|
See [the pagination guide :ref](../../../../guides/pagination/) and the
|
||||||
|
[page order guide :ref](../../../../guides/page-order/).
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```html+jinja
|
||||||
|
{% if this.has_prev() %}
|
||||||
|
<a href="{{ this.get_siblings().prev_page|url }}">previous</a>
|
||||||
|
{% else %}
|
||||||
|
<p>This is the first entry.
|
||||||
|
{% endif %}
|
||||||
|
```
|
||||||
|
|
||||||
|
See also: [has_next :ref](../has_next/) and [get_siblings :ref](../get_siblings/).
|
Loading…
Reference in New Issue