1
0
Fork 0

Integrate pagefind search

This commit is contained in:
Tim Van Baak 2023-09-16 22:01:01 -07:00
parent 75a860a95a
commit 1c25e1830f
4 changed files with 21 additions and 6 deletions

View File

@ -2,6 +2,10 @@
build: build:
./build.py ./build.py
pagefind --site out/
clean:
test -e out && rm -rf out
watch: watch:
while sleep 1; do find src/ build.py Makefile | entr -d make build; done while sleep 1; do find src/ build.py Makefile | entr -d make build; done

View File

@ -22,11 +22,6 @@ def main():
md = markdown.Markdown(extensions=["attr_list", "footnotes", "md_in_html", "meta"]) md = markdown.Markdown(extensions=["attr_list", "footnotes", "md_in_html", "meta"])
comment_md = markdown.Markdown() comment_md = markdown.Markdown()
# Clean the output directory
if out.exists():
print("Removing ", out)
shutil.rmtree(out)
# Load the template # Load the template
template = bs4.BeautifulSoup( template = bs4.BeautifulSoup(
(src / ".template.html").read_text(encoding="utf8"), (src / ".template.html").read_text(encoding="utf8"),

View File

@ -6,4 +6,6 @@ title: Home
=> [Projects I've worked on](./project/). => [Projects I've worked on](./project/).
=> [About this site](./about/). => [About this site](./about/).
=> [Search this site](./search/).

14
src/search/index.md Normal file
View File

@ -0,0 +1,14 @@
---
title: Search
---
Search results generated by [Pagefind](https://pagefind.app/).
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<div id="search"></div>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", showSubResults: true });
});
</script>