Skip to content

Instantly share code, notes, and snippets.

@manbearwolf
Last active November 17, 2017 05:12
Show Gist options
  • Select an option

  • Save manbearwolf/f86195a237ba5d8f5d5f67e147acdbe1 to your computer and use it in GitHub Desktop.

Select an option

Save manbearwolf/f86195a237ba5d8f5d5f67e147acdbe1 to your computer and use it in GitHub Desktop.
<!-- Html Elements for Search -->
<div id="search-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<!-- Script pointing to search-script.js or search-script.min.js https://github.com/christian-fei/Simple-Jekyll-Search/tree/master/dest or in header-->
<script src="{{ site.baseurl }}/js/simple-jekyll-search.min.js" type="text/javascript"></script>
<!-- Configuration & Options https://github.com/christian-fei/Simple-Jekyll-Search#configuration in the default layout
or $(document).ready() (Personally one page load would be best, like tutorial, otherwise Chrome errors a lot (developer mode)....)-->
<!-- Configuration -->
<script>
SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: '{{ site.baseurl }}/search.json'
<!-- Extra Options -->
noResultsText: 'No results found',
limit: 10,
fuzzy: false
})
</script>
---
layout: null
---
[
{% for post in site.posts %}
{
"title" : "{{ post.title | escape }}",
"url" : "{{ site.baseurl }}{{ post.url }}",
"tags" : "{{ post.tags | join: ', ' }}",
"date" : "{{ post.date }}"
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]
@manbearwolf

manbearwolf commented Nov 6, 2017

Copy link
Copy Markdown
Author
<!-- Html Elements for Search -->
<div id="search-container">
<input type="text" id="search-input" placeholder="Search...">
<ul id="results-container"></ul>
</div>

<!-- Script pointing to search-script.js -->
<script src="{{ site.baseurl }}/js/simple-jekyll-search.min.js" type="text/javascript"></script>

<!-- Configuration -->
<script>
SimpleJekyllSearch({
  searchInput: document.getElementById('search-input'),
  resultsContainer: document.getElementById('results-container'),
  json: '{{ site.baseurl }}/search.json'
})
</script>

one page load (Exactly like this... on one page)(chrome errors...development mode show up if in javascript)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment