Skip to content

Commit

Permalink
Add initial search functionality to website
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed Sep 30, 2024
1 parent f8db3a5 commit b257941
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ jobs:
--baseURL "${{ steps.pages.outputs.base_url }}/" \
--source website \
--destination public
# Run pagefind to add search functionality
# Reference: https://pagefind.app/docs/
npx -y pagefind --site public
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
11 changes: 11 additions & 0 deletions website/layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
<script src="{{ .Site.BaseURL }}js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

<!-- Search Bar -->
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", showSubResults: true });
});
</script>

</head>
<body>

Expand All @@ -48,3 +57,5 @@
</div>
</div>
</div>

<div id="search"></div>

0 comments on commit b257941

Please sign in to comment.