Skip to content

Commit 8dc1cf6

Browse files
committed
add Pagefind Search for bndtools website
see https://pagefind.app/docs/installation/ and https://pagefind.app/docs/ Signed-off-by: Christoph Rueger <[email protected]>
1 parent 0b027d3 commit 8dc1cf6

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

.github/scripts/docs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ gem --version
44
bundle --version
55

66
bundle exec jekyll build
7+
8+
# create search index under _site/pagefind
9+
./pagefind --verbose --site _site

.github/workflows/cibuild.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ jobs:
3636
with:
3737
ruby-version: 2.7
3838
bundler-cache: true
39+
40+
# Download and install the Pagefind binary
41+
# see releases: https://github.com/CloudCannon/pagefind/releases
42+
- name: Install Pagefind for Search
43+
run: |
44+
curl -L https://github.com/CloudCannon/pagefind/releases/download/v1.3.0/pagefind-v1.3.0-x86_64-unknown-linux-musl.tar.gz \
45+
-o pagefind.tar.gz
46+
tar xzf pagefind.tar.gz
47+
chmod +x pagefind
48+
3949
- name: Build
4050
run: |
4151
./.github/scripts/docs.sh
52+
53+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/vendor/
77
/bundler/
88
.jekyll-metadata
9+
pagefind*

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ exclude:
6464
- '.project'
6565
- 'run.sh'
6666
- '/vendor'
67+
- '/pagefind'
6768

_layouts/baselayout.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
<div class="row main-container">
99

10+
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
11+
<script src="/pagefind/pagefind-ui.js"></script>
12+
<div id="search"></div>
13+
<script>
14+
window.addEventListener('DOMContentLoaded', (event) => {
15+
new PagefindUI({ element: "#search", showSubResults: true });
16+
});
17+
</script>
18+
1019
<!-- Main Content -->
1120
<div class="large-9 medium-8 medium-push-4 large-push-3 columns">
1221
<div class="off-canvas-wrap move" data-offcanvas>
@@ -21,8 +30,9 @@
2130
</aside>
2231

2332
<!-- main content goes here -->
33+
<main data-pagefind-body>
2434
{{content}}
25-
35+
</main>
2636
<!-- close the off-canvas menu -->
2737
<a class="exit-off-canvas"></a>
2838

run-pagefind.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
# Build into _site folder
5+
export BUNDLE_GEMFILE=$PWD/Gemfile
6+
bundle install --jobs=3 --retry=3 --path=vendor
7+
bundle exec jekyll clean
8+
bundle exec jekyll build -w --incremental
9+
10+
# Run and serve the _site folder with search working
11+
./pagefind --site _site --serve

0 commit comments

Comments
 (0)