diff --git a/content/docs/api/db/record/get_next_sibling/contents.lr b/content/docs/api/db/record/get_next_sibling/contents.lr deleted file mode 100644 index e00c80cd..00000000 --- a/content/docs/api/db/record/get_next_sibling/contents.lr +++ /dev/null @@ -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 %} -Next article: {{ newer.title }} -{% endif %} -``` diff --git a/content/docs/api/db/record/get_previous_sibling/contents.lr b/content/docs/api/db/record/get_previous_sibling/contents.lr deleted file mode 100644 index 813a86b8..00000000 --- a/content/docs/api/db/record/get_previous_sibling/contents.lr +++ /dev/null @@ -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 %} -Previous article: {{ older.title }} -{% endif %} -``` diff --git a/content/docs/api/db/record/get_siblings/contents.lr b/content/docs/api/db/record/get_siblings/contents.lr new file mode 100644 index 00000000..c04d454c --- /dev/null +++ b/content/docs/api/db/record/get_siblings/contents.lr @@ -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 %} + previous +{% endif %} + +{% if siblings.next_page %} + next +{% endif %} +``` + +See also: [has_prev :ref](../has_prev/) and [has_next :ref](../has_next/). diff --git a/content/docs/api/db/record/has_next/contents.lr b/content/docs/api/db/record/has_next/contents.lr new file mode 100644 index 00000000..7edd2cf6 --- /dev/null +++ b/content/docs/api/db/record/has_next/contents.lr @@ -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() %} + next +{% else %} +

This is the last entry. +{% endif %} +``` + +See also: [has_prev :ref](../has_prev/) and [get_siblings :ref](../get_siblings/). diff --git a/content/docs/api/db/record/has_prev/contents.lr b/content/docs/api/db/record/has_prev/contents.lr new file mode 100644 index 00000000..00ab1381 --- /dev/null +++ b/content/docs/api/db/record/has_prev/contents.lr @@ -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() %} + previous +{% else %} +

This is the first entry. +{% endif %} +``` + +See also: [has_next :ref](../has_next/) and [get_siblings :ref](../get_siblings/).