Skip to content

Commit

Permalink
Remove the less useful, and too often broken, search box
Browse files Browse the repository at this point in the history
  • Loading branch information
krwenholz committed May 21, 2024
1 parent 4cf6699 commit 69a4717
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 80 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ jobs:
with:
entrypoint: zola
args: build
- name: Build tinysearch
uses: docker://tinysearch/cli:0.8
with:
entrypoint: tinysearch
args: --optimize --path public/search public/search/index.html
- name: fix search
run: |
mv public/search public/search_old
mkdir public/search
mv public/search_old/* public/search
rm -rf public/search_old
sudo chown runner:docker public/search/*
- name: Publish
uses: peaceiris/actions-gh-pages@v4
with:
Expand Down
46 changes: 0 additions & 46 deletions templates/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,6 @@
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

<!-- Search import
================================================== -->
<script type="module">
import { search, default as init } from "/search/tinysearch_engine.js";
window.search = search;

async function run() {
await init("/search/tinysearch_engine_bg.wasm");
}

run();
</script>

<script>
const doSearch = () => {
let value = document.getElementById("search_input").value;
const arr = window.search(value, 10);
let ul = document.getElementById("search_results");
ul.innerHTML = "";

for (i = 0; i < arr.length; i++) {
var li = document.createElement("li");

let elem = arr[i];
let elemlink = document.createElement("a");
elemlink.innerHTML = elem[0];
elemlink.setAttribute("href", elem[1]);
li.appendChild(elemlink);
li.classList.add("mt-1", "mb-1");

ul.appendChild(li);
}

if (ul.innerHTML) {
ul.classList.add("visible");
ul.classList.remove("invisible");
} else {
var li = document.createElement("li");
li.innerHTML = "No results";
li.classList.add("mt-1", "mb-1");

ul.appendChild(li);
}
};
</script>

<link href="/css?family=Inconsolata" rel="stylesheet" type="text/css" />

<link href="/base.css" rel="stylesheet" type="text/css" />
Expand Down
16 changes: 2 additions & 14 deletions templates/_includes/heading.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,8 @@
<div class="col-auto">
<a href="/resources/" class="nav-link">Resources</a>
</div>
<div class="col-sm position-relative">
<input
id="search_input"
type="text"
oninput="doSearch()"
class="form-control mr-2"
placeholder="Search"
aria-label="Search"
/>
<ul
id="search_results"
class="invisible list-unstyled bg-dark border rounded shadow-md p-3"
aria-label="Search Results"
></ul>
<div class="col-auto">
<a href="/posts/" class="nav-link">Posts</a>
</div>
</div>

Expand Down
8 changes: 0 additions & 8 deletions templates/search.html

This file was deleted.

0 comments on commit 69a4717

Please sign in to comment.