mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-19 01:22:23 -06:00
Avoid Liquid failure with empty collections (#1092)
Avoid Liquid failure when no pages with titles Fix issue #1085 The user's config specified collections (incorrectly). Trying to build the site resulted in Jekyll failing due to a Liquid error. The error report did not suggest the cause of the error. Liquid fails with division by 0 when title_pages_size is 0. This fix guards that code by checking that title_pages is non-empty. To test: 1. Specify a Jekyll collection with no pages, and specify it as a JTD collection. 2. Build the site. 3. Check that the specified collection has no nav links to pages.
This commit is contained in:
parent
0279757ff4
commit
0bfa011b47
@ -39,6 +39,7 @@
|
|||||||
pages.
|
pages.
|
||||||
{%- endcomment -%}
|
{%- endcomment -%}
|
||||||
|
|
||||||
|
{%- unless title_pages == empty -%}
|
||||||
{%- assign unsorted_pages = title_pages
|
{%- assign unsorted_pages = title_pages
|
||||||
| where_exp: "item", "item.parent == nil"
|
| where_exp: "item", "item.parent == nil"
|
||||||
| where_exp: "item", "item.nav_exclude == true" -%}
|
| where_exp: "item", "item.nav_exclude == true" -%}
|
||||||
@ -54,6 +55,7 @@
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- assign title_pages = sorted_pages -%}
|
{%- assign title_pages = sorted_pages -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{%- endunless -%}
|
||||||
|
|
||||||
{%- assign nav_order_pages = title_pages
|
{%- assign nav_order_pages = title_pages
|
||||||
| where_exp: "item", "item.nav_order != nil" -%}
|
| where_exp: "item", "item.nav_order != nil" -%}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user