Integrate pagefind search
This commit is contained in:
parent
75a860a95a
commit
1c25e1830f
4
Makefile
4
Makefile
@ -2,6 +2,10 @@
|
||||
|
||||
build:
|
||||
./build.py
|
||||
pagefind --site out/
|
||||
|
||||
clean:
|
||||
test -e out && rm -rf out
|
||||
|
||||
watch:
|
||||
while sleep 1; do find src/ build.py Makefile | entr -d make build; done
|
||||
|
5
build.py
5
build.py
@ -22,11 +22,6 @@ def main():
|
||||
md = markdown.Markdown(extensions=["attr_list", "footnotes", "md_in_html", "meta"])
|
||||
comment_md = markdown.Markdown()
|
||||
|
||||
# Clean the output directory
|
||||
if out.exists():
|
||||
print("Removing ", out)
|
||||
shutil.rmtree(out)
|
||||
|
||||
# Load the template
|
||||
template = bs4.BeautifulSoup(
|
||||
(src / ".template.html").read_text(encoding="utf8"),
|
||||
|
@ -6,4 +6,6 @@ title: Home
|
||||
|
||||
=> [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
14
src/search/index.md
Normal 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>
|
Loading…
Reference in New Issue
Block a user