mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-09-13 05:13:33 -06:00
Merge pull request #379 from SgtSilvio/feature/doc-collections
Feature/doc collections
This commit is contained in:
@@ -12,8 +12,21 @@ namespace :search do
|
||||
permalink: /assets/js/search-data.json
|
||||
---
|
||||
{
|
||||
{%- assign i = 0 -%}
|
||||
{% for page in site.html_pages %}
|
||||
{%- assign i = 0 -%}
|
||||
{%- assign pages_array = '' | split: '' -%}
|
||||
{%- assign pages_array = pages_array | push: site.html_pages -%}
|
||||
{%- if site.just_the_docs.collections -%}
|
||||
{%- for collection_entry in site.just_the_docs.collections -%}
|
||||
{%- assign collection_key = collection_entry[0] -%}
|
||||
{%- assign collection_value = collection_entry[1] -%}
|
||||
{%- assign collection = site[collection_key] -%}
|
||||
{%- if collection_value.search_exclude != true -%}
|
||||
{%- assign pages_array = pages_array | push: collection -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- for pages in pages_array -%}
|
||||
{%- for page in pages -%}
|
||||
{%- if page.title and page.search_exclude != true -%}
|
||||
{%- assign page_content = page.content -%}
|
||||
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
||||
@@ -24,7 +37,7 @@ permalink: /assets/js/search-data.json
|
||||
{%- endfor -%}
|
||||
{%- assign parts = page_content | split: \'<h1\' -%}
|
||||
{%- assign title_found = false -%}
|
||||
{% for part in parts offset: 1 %}
|
||||
{%- for part in parts offset: 1 -%}
|
||||
{%- assign titleAndContent = part | split: \'</h1>\' -%}
|
||||
{%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
|
||||
{%- assign title = title[1] | strip_html -%}
|
||||
@@ -64,7 +77,8 @@ permalink: /assets/js/search-data.json
|
||||
{%- assign i = i | plus: 1 -%}
|
||||
{%- endunless -%}
|
||||
{%- endif -%}
|
||||
{% endfor %}
|
||||
{%- endfor -%}
|
||||
{%- endfor %}
|
||||
}'
|
||||
end
|
||||
puts 'Done.'
|
||||
|
Reference in New Issue
Block a user