aboutsummaryrefslogtreecommitdiff
path: root/templates/macros/create_tinysearch_json.html
diff options
context:
space:
mode:
authorJieiku2022-09-20 17:34:19 -0700
committerJieiku2022-09-20 17:34:19 -0700
commit864a89104bd444fbebb9dcbe3ed853c28f8b21e7 (patch)
treee9bd0165ac208d4b5ebe7ee2223c218f6ad78ed6 /templates/macros/create_tinysearch_json.html
parent7d691159df6e0f64129d3c11f4e8026dca3a72d1 (diff)
downloadabridge-864a89104bd444fbebb9dcbe3ed853c28f8b21e7.tar.gz
abridge-864a89104bd444fbebb9dcbe3ed853c28f8b21e7.tar.bz2
abridge-864a89104bd444fbebb9dcbe3ed853c28f8b21e7.zip
Fix index generation when all pages in a section are drafts, closes #93
Diffstat (limited to 'templates/macros/create_tinysearch_json.html')
-rw-r--r--templates/macros/create_tinysearch_json.html5
1 files changed, 3 insertions, 2 deletions
diff --git a/templates/macros/create_tinysearch_json.html b/templates/macros/create_tinysearch_json.html
index f45ed42..a28d9dc 100644
--- a/templates/macros/create_tinysearch_json.html
+++ b/templates/macros/create_tinysearch_json.html
@@ -2,6 +2,7 @@
{%- set section = get_section(path=section) -%}
{%- for post in section.pages -%}
{%- if not post.draft -%}
+{%- set found = true -%}
{
"title": {{ post.title | striptags | json_encode | safe }},
"url": {{ post.permalink | json_encode | safe }},
@@ -17,10 +18,10 @@
{%- if not loop.last -%},{%- endif %}
{%- endif -%}
{%- endfor -%}
-{%- if section.subsections -%}
+{%- if found -%}{%- if section.subsections -%}
,
{%- for subsection in section.subsections -%}
{{ self::from_section(section=subsection) }}
{%- endfor -%}
-{%- endif -%}
+{%- endif -%}{%- endif -%}
{%- endmacro from_section -%} \ No newline at end of file