Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Search functionality to EPIC Guide #59

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ collections:
output: true
permalink: /:collection/:name
order: 4
search:
name: Search
output: true
permalink: /:collection/:name
order: 5
12 changes: 12 additions & 0 deletions _includes/google-search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
(function() {
var cx = 'e20a3e7ce37c2454c';
var gcse = document.createElement('script');
vinitra marked this conversation as resolved.
Show resolved Hide resolved
gcse.type = 'text/javascript';
vinitra marked this conversation as resolved.
Show resolved Hide resolved
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
vinitra marked this conversation as resolved.
Show resolved Hide resolved
var s = document.getElementsByTagName('script')[0];
vinitra marked this conversation as resolved.
Show resolved Hide resolved
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>
vinitra marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion _life/well-being.md → _middle/well-being.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: post
title: "Well-being"
title: "Well-being & Mental Health"
vinitra marked this conversation as resolved.
Show resolved Hide resolved
category: life
order: 1
---
Expand Down
14 changes: 14 additions & 0 deletions search.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: null
---
[
{% for post in site.posts %}
{
"title" : "{{ post.title | escape }}",
"category" : "{{ post.category }}",
"tags" : "{{ post.tags | join: ', ' }}",
"url" : "{{ site.baseurl }}{{ post.url }}",
"content": "{{ page.content | strip_html | strip_newlines | remove_chars | escape }}"
} {% unless forloop.last %},{% endunless %}
vinitra marked this conversation as resolved.
Show resolved Hide resolved
{% endfor %}
]
9 changes: 9 additions & 0 deletions search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: guide
title: Search
collection: search
---

Search for anything within the EPIC guide. If you can't find what you're looking for, please open a PR or an issue on our [github repository](https://github.com/EPIC-guide/epic-guide.github.io)!

{% include google-search.html %}
6 changes: 6 additions & 0 deletions search_script.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.