Skip to content

Commit 1d37950

Browse files
committed
Attempted simple jekyll search, not working
1 parent 84a8bcc commit 1d37950

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

_includes/head.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,13 @@
3434
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
3535
<script src="{{ 'assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
3636
<script src="{{ 'assets/js/toc.js' | relative_url }}"></script>
37+
<script src="{{ 'assets/js/simple-jekyll-search.min.js' | relative_url }}"></script>
3738
<script defer src="{{'assets/js/all.min.js' | relative_url }}"></script>
39+
<script>
40+
SimpleJekyllSearch({
41+
searchInput: document.getElementById('search-input'),
42+
resultsContainer: document.getElementById('results-container'),
43+
json: '/search.json'
44+
})
45+
</script>
3846
</head>

_includes/header.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<a class="visually-hidden-focusable" href='#main'>Skip to content</a>
22
<header id="header_wrap" class="p-3">
33
<!--start search-->
4-
<div class="search-outer">
4+
<div class="search-outer" id="search-container">
55
<!--<div class="position-relative">-->
6-
<form role="search rounded-bottom" class="input-group">
6+
<!--ETT<form role="search rounded-bottom" class="input-group">
77
<span class="input-group-text" id="search-label"><i class="fa-solid fa-magnifying-glass"></i></span><input type="search" id="search-input" class="search-input form-control" tabindex="0" placeholder="Search..." aria-label="Search..." autocomplete="off">
8-
</form>
8+
</form>-->
9+
<input type="text" id="search-input" placeholder="Type your search here..." autofocus>
10+
<ul id="results-container"></ul>
911
<div id="search-results" class="search-results"></div>
1012
<!--</div>-->
1113
</div>

assets/js/simple-jekyll-search.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

search.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: none
3+
---
4+
5+
[
6+
{% for page in site.pages %}
7+
{% assign urlend = page.url | slice: -4, 4 %}
8+
{% if urlend != ".css" and urlend != ".xml" and urlend != "json" %}
9+
{
10+
"title" : "{{ page.title }}",
11+
"url" : "{{ site.baseurl }}{{ page.url }}",
12+
"collection" : "{{page.collection}}",
13+
"tags" : "{{ page.tags | join: ', ' }}",
14+
"date" : "{{ page.date | date_to_string }}",
15+
"description" : "{{ page.content | strip_html | strip_newlines | escape }}"
16+
}
17+
{% unless forloop.last %},{% endunless %}
18+
{% endif %}
19+
{% endfor %}
20+
]

0 commit comments

Comments
 (0)