Skip to content

Instantly share code, notes, and snippets.

@manbearwolf
Created November 16, 2017 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manbearwolf/332863d0686eadc7a0224691470f18be to your computer and use it in GitHub Desktop.
Save manbearwolf/332863d0686eadc7a0224691470f18be to your computer and use it in GitHub Desktop.
LunrJS JSON Setup
---
layout: null
---
{
{% for post in site.posts %}
"{{ post.url | slugify }}": {
"title": "{{ post.title | xml_escape }}",
"content" : "{{post.content | strip_html | strip_newlines | remove: " " | escape | remove: "\"}}",
"url": "{{ site.baseurl }}{{ post.url | xml_escape }}",
"author": "{{ post.author | xml_escape }}",
"categories": "{% for category in post.categories %}{{ category }}{% unless forloop.last %}, {% endunless %}{% endfor %}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
{% for page in site.pages %}
{% if page.url == '/speaking/index.html' or page.url == '/if-rudyard-kipling/index.html' or page.url == '/about/index.html' or page.url == '/contact/index.html' or page.url == '/sudo-disclaimer/index.html' %}
,
"{{ page.url | slugify }}": {
"title": "{{ page.title | xml_escape }}",
"content" : "{{page.content | strip_html | strip_newlines | remove: " " | escape | remove: "\"}}",
"url": "{{ site.baseurl }}{{ page.url | xml_escape }}"
}
{% endif %}
{% endfor %}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment