Initial commit
This commit is contained in:
18
assets/js/lunr-store.js
Normal file
18
assets/js/lunr-store.js
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# create lunr store for search page
|
||||
---
|
||||
{% if site.data.theme.search-child-objects == true %}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{% else %}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid and item.parentid == nil' -%}
|
||||
{% endif %}
|
||||
{%- assign fields = site.data.config-search -%}
|
||||
var store = [
|
||||
{%- for item in items -%}
|
||||
{
|
||||
{% for f in fields %}{% if item[f.field] %}{{ f.field | jsonify }}: {{ item[f.field] | normalize_whitespace | replace: '""','"' | jsonify }},{% endif %}{% endfor %}
|
||||
"id": {% if item.parentid %}{{ item.parentid | append: '.html#' | append: item.objectid | jsonify }}{% else %}{{item.objectid | append: '.html' | jsonify }}{% endif %}
|
||||
|
||||
}{%- unless forloop.last -%},{%- endunless -%}
|
||||
{%- endfor -%}
|
||||
];
|
||||
13
assets/js/metadata.min.json
Normal file
13
assets/js/metadata.min.json
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
# metadata for table ajax
|
||||
---
|
||||
{% if site.data.theme.data-child-objects == true %}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid' -%}
|
||||
{% else %}
|
||||
{%- assign items = site.data[site.metadata] | where_exp: 'item','item.objectid and item.parentid == nil' -%}
|
||||
{% endif %}
|
||||
{%- assign fields = site.data.config-table | map: 'field' -%}
|
||||
{ "objects": [
|
||||
{%- for item in items -%}[ {% for f in fields %}{% if item[f] %}{{ item[f] | jsonify }}{% else %}""{% endif %},{% endfor %} "{{ '/items/' | relative_url }}{% if item.parentid %}{{ item.parentid }}.html#{{ item.objectid }}{% else %}{{ item.objectid }}.html{% endif %}" ]{% unless forloop.last %},{% endunless %}
|
||||
{% endfor %}
|
||||
] }
|
||||
Reference in New Issue
Block a user