Sha256: 1149d146fe742d545719044f43c5bc7bbfcfb94744c4bfc2749d736f83818aeb
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
{%- assign page_list = site.pages | where_exp: "item", "item.title != nil" -%} <script defer> var posts = []; {% for page in page_list %} {%- assign psearch_tree = page.path | split: "/" -%} {% if psearch_tree.last == "index.md" %} {%- assign p_type = "category" -%} {% else %} {%- assign p_type = "post" -%} {% endif %} {%- assign tree_len = psearch_tree.size | minus: 2 -%} {%- assign psearch_tree = psearch_tree | slice:1, tree_len -%} {%- assign p_link = "" -%} {%- for sub_tree in psearch_tree -%} {% if forloop.last %} {%- assign p_link = p_link | append: sub_tree -%} {% else %} {%- assign p_link = p_link | append: sub_tree | append: " > " -%} {% endif %} {%- endfor -%} posts.push({ 'title' : "{{ page.title | escape }}", 'path' : "{{ p_link }}", 'type' : "{{ p_type }}", 'tags' : "{{ page.tags | join: ', ' }}", 'url' : "{{ site.baseurl }}{{ page.url }}", 'image' : "{{ page.thumbnail }}", 'date' : "{{ page.date | date: '%Y-%m-%d' }}" }); {% endfor %} searchPost(posts); {% if page_type == "post" %} searchRelated(posts); {% endif %} </script>
Version data entries
4 entries across 4 versions & 1 rubygems