feat: search.liquid over all collections (#2447)
Thank you @george-gca for the awesome work. on #2415. This PR generalizes the search on all collections. Currently, only projects are added to the search. This PR uses all of them, such as news. On my personal website, I use a teaching collection which is then also automatically searched.
This commit is contained in:
parent
96c4e61385
commit
e8a2a40ae8
|
|
@ -84,18 +84,20 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- for project in site.projects -%}
|
{% for collection in site.collections %}
|
||||||
|
{%- for item in collection.docs -%}
|
||||||
{
|
{
|
||||||
{%- assign title = project.title | escape -%}
|
{%- assign title = item.title | escape -%}
|
||||||
id: "project-{{ title | slugify }}",
|
id: "{{ collection.label }}-{{ title | slugify }}",
|
||||||
title: "{{ title }}",
|
title: "{{ title }}",
|
||||||
description: "{{ project.description | strip_html | strip_newlines | escape }}",
|
description: "{{ item.description | strip_html | strip_newlines | escape }}",
|
||||||
section: "Projects",
|
section: "{{ collection.label | capitalize }}",
|
||||||
handler: () => {
|
handler: () => {
|
||||||
window.location.href = "{{ project.url | relative_url }}";
|
window.location.href = "{{ item.url | relative_url }}";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
{% endfor %}
|
||||||
{%- if site.socials_in_search -%}
|
{%- if site.socials_in_search -%}
|
||||||
{%- if site.email -%}
|
{%- if site.email -%}
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue