mirror of
https://github.com/thangisme/notes.git
synced 2024-12-22 02:26:22 -05:00
Updated search.rake
This commit is contained in:
parent
93f93f48a7
commit
d476ce5748
@ -12,8 +12,17 @@ namespace :search do
|
|||||||
permalink: /assets/js/search-data.json
|
permalink: /assets/js/search-data.json
|
||||||
---
|
---
|
||||||
{
|
{
|
||||||
{%- assign i = 0 -%}
|
{% assign i = 0 -%}
|
||||||
{% for page in site.html_pages %}
|
{%- assign pages_array = \'\' | split: \'\' -%}
|
||||||
|
{%- assign pages_array = pages_array | push: site.html_pages -%}
|
||||||
|
{%- if site.doc_collections -%}
|
||||||
|
{%- for doc_collection in site.doc_collections -%}
|
||||||
|
{%- assign collection = site[doc_collection.collection] -%}
|
||||||
|
{%- assign pages_array = pages_array | push: collection -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- for pages in pages_array -%}
|
||||||
|
{%- for page in pages -%}
|
||||||
{%- if page.title and page.search_exclude != true -%}
|
{%- if page.title and page.search_exclude != true -%}
|
||||||
{%- assign page_content = page.content -%}
|
{%- assign page_content = page.content -%}
|
||||||
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
{%- assign heading_level = site.search.heading_level | default: 2 -%}
|
||||||
@ -24,7 +33,7 @@ permalink: /assets/js/search-data.json
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- assign parts = page_content | split: \'<h1\' -%}
|
{%- assign parts = page_content | split: \'<h1\' -%}
|
||||||
{%- assign title_found = false -%}
|
{%- assign title_found = false -%}
|
||||||
{% for part in parts offset: 1 %}
|
{%- for part in parts offset: 1 -%}
|
||||||
{%- assign titleAndContent = part | split: \'</h1>\' -%}
|
{%- assign titleAndContent = part | split: \'</h1>\' -%}
|
||||||
{%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
|
{%- assign title = titleAndContent[0] | replace_first: \'>\', \'<h1>\' | split: \'<h1>\' -%}
|
||||||
{%- assign title = title[1] | strip_html -%}
|
{%- assign title = title[1] | strip_html -%}
|
||||||
@ -64,7 +73,8 @@ permalink: /assets/js/search-data.json
|
|||||||
{%- assign i = i | plus: 1 -%}
|
{%- assign i = i | plus: 1 -%}
|
||||||
{%- endunless -%}
|
{%- endunless -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{% endfor %}
|
{%- endfor -%}
|
||||||
|
{%- endfor %}
|
||||||
}'
|
}'
|
||||||
end
|
end
|
||||||
puts 'Done.'
|
puts 'Done.'
|
||||||
|
Loading…
Reference in New Issue
Block a user