jekyll-pagefind 0.3.3-x86_64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +244 -0
- data/assets/linux-x64/pagefind +0 -0
- data/jekyll-pagefind.gemspec +49 -0
- data/lib/jekyll-pagefind.rb +121 -0
- data/lib/version.rb +7 -0
- metadata +81 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2350b3de247290c5ca7c3c9d8a8315471912a81ef152f929218db13b9af4156f
|
|
4
|
+
data.tar.gz: 68e6e9a724399a7886d91d826b3af29fa2261b004210cb9d41a1fb615d40c4e5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 199035aafc71e892bb1cbc44052c86a7c87d428a17bb5a5b39e50f97896c6d97e3138c131a2533b9b22da5fd819b5cae332fc23ab70b64dc213408dd3938248a
|
|
7
|
+
data.tar.gz: c8b5476f56c01ff4c4d3ff355ff243cc75209472c3906a6c7b066540aaf16e663c097e21dc9d3fab0b9b09c4255d6d931a98ec23537d479496ca4b7078b3781a
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 phothinmg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<!-- markdownlint-disable MD033 -->
|
|
2
|
+
<!-- markdownlint-disable MD041 -->
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://susee.phothin.dev/logo/rubygems_logo.png" width="160" height="160" alt="mmdevs" style="border-radius:50%" />
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">jekyll-pagefind</h1>
|
|
7
|
+
|
|
8
|
+
[](https://badge.fury.io/rb/jekyll-pagefind)
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Jekyll-Pagefind is a plugin that runs the Pagefind binary for a Jekyll site.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
Install the gem and add it to your application's Gemfile by running:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
bundle add jekyll-pagefind
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
In your `Gemfile`:
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
group :jekyll_plugins do
|
|
26
|
+
# other jekyll plugins
|
|
27
|
+
gem 'jekyll-pagefind' # add pagefind plugin
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
bundle install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If Bundler is not being used to manage dependencies, install the gem by running:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
gem install jekyll-pagefind
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
RubyGems will install the platform-specific package that matches the host OS and CPU.
|
|
42
|
+
If no matching platform gem is selected, the generic `ruby` gem raises a clear error telling the user to add the deploy platform to `Gemfile.lock`.
|
|
43
|
+
|
|
44
|
+
## Use
|
|
45
|
+
|
|
46
|
+
### Jekyll site configuration
|
|
47
|
+
|
|
48
|
+
**`_config.yml`**
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
plugins:
|
|
52
|
+
# other plugin
|
|
53
|
+
- jekyll-pagefind
|
|
54
|
+
# other config
|
|
55
|
+
# Optional Jekyll Pagefind Options
|
|
56
|
+
jekyll_pagefind:
|
|
57
|
+
output_subdir: pagefind
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Jekyll Pagefind options (optional)
|
|
63
|
+
|
|
64
|
+
These options map to the settings available in [Pagefind config files](https://pagefind.app/docs/config-sources/#:~:text=overriding%20configuration%20files.-,Config%20files,-Pagefind%20will%20look).
|
|
65
|
+
|
|
66
|
+
For more details, see [Pagefind CLI configuration options](https://pagefind.app/docs/config-options/). `jekyll_pagefind` supports the following options.
|
|
67
|
+
|
|
68
|
+
#### 1. output_subdir
|
|
69
|
+
|
|
70
|
+
The folder where the search bundle is written, relative to Jekyll `{{ site.dest }}`. The default is `pagefind`.
|
|
71
|
+
|
|
72
|
+
**Example:**
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
output_subdir: pf # becomes _site/pf
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### 2. exclude_selectors
|
|
79
|
+
|
|
80
|
+
Pass extra element selectors that Pagefind should ignore when indexing.
|
|
81
|
+
|
|
82
|
+
**Example :**
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
exclude_selectors:
|
|
86
|
+
- "#my_navigation"
|
|
87
|
+
- "blockquote > span"
|
|
88
|
+
- "[id^='prefix-']"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### 3. keep_index_url
|
|
92
|
+
|
|
93
|
+
Keeps `index.html` at the end of search result paths. The default is `false`.
|
|
94
|
+
|
|
95
|
+
By default, a file at `animals/cat/index.html` will be given the URL `/animals/cat/`. Setting this option to true will result in the URL `/animals/cat/index.html`.
|
|
96
|
+
|
|
97
|
+
#### 4. quiet
|
|
98
|
+
|
|
99
|
+
Logs only errors and warnings while indexing the site.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Pagefind UI
|
|
104
|
+
|
|
105
|
+
#### 1. Using the Default UI
|
|
106
|
+
|
|
107
|
+
Using the Default UI is still supported, but it is no longer Pagefind's primary recommendation.
|
|
108
|
+
|
|
109
|
+
You can add the Pagefind UI to any page with the following snippet. The `/pagefind/` directory, or the directory specified by `output_subdir` in the [config](#1-output_subdir), will be created along with its files.
|
|
110
|
+
|
|
111
|
+
```liquid
|
|
112
|
+
<script src="{{ '/pagefind/pagefind-ui.js' | relative_url }}"></script>
|
|
113
|
+
<link rel="stylesheet" href="{{ '/pagefind/pagefind-ui.css' | relative_url }}" />
|
|
114
|
+
|
|
115
|
+
<div id="search"></div>
|
|
116
|
+
<script>
|
|
117
|
+
window.addEventListener('DOMContentLoaded', (event) => {
|
|
118
|
+
new PagefindUI({ element: "#search", showSubResults: true });
|
|
119
|
+
});
|
|
120
|
+
</script>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For dark mode:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
body.dark {
|
|
127
|
+
--pagefind-ui-primary: #eeeeee;
|
|
128
|
+
--pagefind-ui-text: #eeeeee;
|
|
129
|
+
--pagefind-ui-background: #152028;
|
|
130
|
+
--pagefind-ui-border: #152028;
|
|
131
|
+
--pagefind-ui-tag: #152028;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
For more details, see [Using the Default UI](https://pagefind.app/docs/ui-usage/).
|
|
136
|
+
|
|
137
|
+
#### 2. Pagefind Component UI
|
|
138
|
+
|
|
139
|
+
Add the following snippet to `<head>`. The `/pagefind/` directory, or the directory specified by `output_subdir` in the [config](#1-output_subdir), will be created along with its files.
|
|
140
|
+
|
|
141
|
+
```liquid
|
|
142
|
+
<script src="{{ '/pagefind/pagefind-component-ui.js' | relative_url }}" type="module"></script>
|
|
143
|
+
<link rel="stylesheet" href="{{ '/pagefind/pagefind-component-ui.css' | relative_url }}" />
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
For dark mode:
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<div data-pf-theme="dark">
|
|
150
|
+
<pagefind-searchbox></pagefind-searchbox>
|
|
151
|
+
</div>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```css
|
|
155
|
+
@media (prefers-color-scheme: dark) {
|
|
156
|
+
:root {
|
|
157
|
+
--pf-text: #e5e5e5;
|
|
158
|
+
--pf-text-secondary: #a0a0a0;
|
|
159
|
+
--pf-text-muted: #949494;
|
|
160
|
+
--pf-background: #1a1a1a;
|
|
161
|
+
--pf-border: #333;
|
|
162
|
+
--pf-border-focus: #555;
|
|
163
|
+
--pf-skeleton: #2a2a2a;
|
|
164
|
+
--pf-skeleton-shine: #333;
|
|
165
|
+
--pf-hover: #252525;
|
|
166
|
+
--pf-mark: #e5e5e5;
|
|
167
|
+
--pf-scroll-shadow: rgba(255, 255, 255, 0.1);
|
|
168
|
+
--pf-outline-focus: #58a6ff;
|
|
169
|
+
|
|
170
|
+
--pf-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
171
|
+
--pf-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
172
|
+
--pf-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
|
|
173
|
+
|
|
174
|
+
--pf-error-bg: #2a1a1a;
|
|
175
|
+
--pf-error-border: #5c2828;
|
|
176
|
+
--pf-error-text: #f87171;
|
|
177
|
+
--pf-error-text-secondary: #ef4444;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
For more details, see [Pagefind Component UI](https://pagefind.app/docs/search-ui/).
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Contributing
|
|
187
|
+
|
|
188
|
+
## Maintainer Release Notes
|
|
189
|
+
|
|
190
|
+
This gem is published as platform-specific packages so users only download the binary for their host OS.
|
|
191
|
+
|
|
192
|
+
Build the current host variant:
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
make build
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Run the fixture-based smoke test:
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
make smoke-test
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Build every supported variant:
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
make build-all
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Publish the built platform gems for a version:
|
|
211
|
+
|
|
212
|
+
```sh
|
|
213
|
+
make publish
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
GitHub Actions trusted publishing is supported.
|
|
217
|
+
|
|
218
|
+
To enable it on RubyGems.org for this repo:
|
|
219
|
+
|
|
220
|
+
1. Open the `jekyll-pagefind` gem page.
|
|
221
|
+
2. Go to `Trusted publishers`.
|
|
222
|
+
3. Create a publisher with repository `phothinmg/jekyll-pagefind`, workflow filename `release.yml`, and environment `release`.
|
|
223
|
+
|
|
224
|
+
After that, pushing a tag like `v0.3.2` will run `.github/workflows/release.yml` and publish all built gems without a stored API token or manual OTP entry.
|
|
225
|
+
|
|
226
|
+
`bin/build-platform-gems` currently maps these asset folders to RubyGems platforms:
|
|
227
|
+
|
|
228
|
+
- `ruby` -> `ruby` (generic fallback gem with no bundled binary)
|
|
229
|
+
- `assets/linux-x64` -> `x86_64-linux-gnu`, `x86_64-linux-musl`
|
|
230
|
+
- `assets/linux-arm64` -> `aarch64-linux-gnu`, `aarch64-linux-musl`
|
|
231
|
+
- `assets/macos-x64` -> `x86_64-darwin`
|
|
232
|
+
- `assets/macos-arm64` -> `arm64-darwin`
|
|
233
|
+
- `assets/windows-x64` -> `x64-mingw32`, `x64-mingw-ucrt`
|
|
234
|
+
- `assets/windows-arm64` -> `arm64-mingw32`, `arm64-mingw-ucrt`
|
|
235
|
+
|
|
236
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/phothinmg/jekyll-pagefind>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/phothinmg/jekyll-pagefind/blob/master/CODE_OF_CONDUCT.md).
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
241
|
+
|
|
242
|
+
## Code of Conduct
|
|
243
|
+
|
|
244
|
+
Everyone interacting in the Jekyll::Pagefind project's codebase, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/phothinmg/jekyll-pagefind/blob/master/CODE_OF_CONDUCT.md).
|
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require_relative "lib/version"
|
|
5
|
+
|
|
6
|
+
host_os = RbConfig::CONFIG["host_os"]
|
|
7
|
+
host_cpu = RbConfig::CONFIG["host_cpu"]
|
|
8
|
+
|
|
9
|
+
default_pagefind_asset_directory = case host_os
|
|
10
|
+
when /darwin|mac os/i
|
|
11
|
+
host_cpu =~ /arm64|aarch64/i ? "assets/macos-arm64" : "assets/macos-x64"
|
|
12
|
+
when /linux/i
|
|
13
|
+
host_cpu =~ /arm64|aarch64/i ? "assets/linux-arm64" : "assets/linux-x64"
|
|
14
|
+
when /mswin|msys|mingw|cygwin|bccwin/i
|
|
15
|
+
host_cpu =~ /arm64|aarch64/i ? "assets/windows-arm64" : "assets/windows-x64"
|
|
16
|
+
else
|
|
17
|
+
raise "Unable to determine a default Pagefind asset directory for host environment: #{host_os} (#{host_cpu})" # rubocop:disable Layout/LineLength
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
pagefind_asset_directory = ENV.fetch("PAGEFIND_ASSET_DIR", default_pagefind_asset_directory)
|
|
21
|
+
pagefind_gem_platform = ENV.fetch("PAGEFIND_GEM_PLATFORM", Gem::Platform::RUBY)
|
|
22
|
+
pagefind_include_assets = ENV.fetch("PAGEFIND_INCLUDE_ASSETS", "true") == "true"
|
|
23
|
+
|
|
24
|
+
Gem::Specification.new do |spec|
|
|
25
|
+
spec.name = "jekyll-pagefind"
|
|
26
|
+
spec.version = Jekyll::Pagefind::VERSION
|
|
27
|
+
spec.platform = Gem::Platform.new(pagefind_gem_platform)
|
|
28
|
+
spec.authors = ["phothinmg"]
|
|
29
|
+
spec.email = ["phothinmg@disroot.org"]
|
|
30
|
+
|
|
31
|
+
spec.summary = "Pagefind plugin for Jekyll"
|
|
32
|
+
spec.description = "Run pagefind binary in jekyll site"
|
|
33
|
+
spec.homepage = "https://rubygems.org/gems/jekyll-pagefind"
|
|
34
|
+
spec.license = "MIT"
|
|
35
|
+
spec.required_ruby_version = ">= 3.1.0"
|
|
36
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
37
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
38
|
+
spec.metadata["source_code_uri"] = "https://github.com/phothinmg/jekykll-pagefind"
|
|
39
|
+
spec.metadata["changelog_uri"] = "https://github.com/phothinmg/jekykll-pagefind/blob/main/CHANGELOG.md"
|
|
40
|
+
|
|
41
|
+
spec.files = Dir.chdir(__dir__) do
|
|
42
|
+
files = ["README.md", "LICENSE.txt", "lib/**/*", "jekyll-pagefind.gemspec"]
|
|
43
|
+
files << "#{pagefind_asset_directory}/**/*" if pagefind_include_assets
|
|
44
|
+
Dir[*files]
|
|
45
|
+
end
|
|
46
|
+
spec.require_paths = ["lib"]
|
|
47
|
+
spec.add_dependency "jekyll", "~> 4.4"
|
|
48
|
+
spec.add_dependency "open3", "~> 0.2.1"
|
|
49
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rbconfig"
|
|
4
|
+
require "open3"
|
|
5
|
+
require "jekyll"
|
|
6
|
+
require "shellwords"
|
|
7
|
+
|
|
8
|
+
require_relative "version"
|
|
9
|
+
|
|
10
|
+
module Jekyll
|
|
11
|
+
# module Jekyll::Pagefind
|
|
12
|
+
module Pagefind
|
|
13
|
+
GEM_ROOT = File.expand_path("..", __dir__)
|
|
14
|
+
|
|
15
|
+
def self.pagefind_binary_path # rubocop:disable Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
16
|
+
os = RbConfig::CONFIG["host_os"]
|
|
17
|
+
cpu = RbConfig::CONFIG["host_cpu"]
|
|
18
|
+
|
|
19
|
+
case os
|
|
20
|
+
when /darwin|mac os/i
|
|
21
|
+
# Differentiate between Apple Silicon and Intel Macs
|
|
22
|
+
if cpu =~ /arm64|aarch64/i
|
|
23
|
+
File.join(GEM_ROOT, "assets", "macos-arm64",
|
|
24
|
+
"pagefind")
|
|
25
|
+
else
|
|
26
|
+
File.join(GEM_ROOT, "assets", "macos-x64", "pagefind")
|
|
27
|
+
end
|
|
28
|
+
when /linux/i
|
|
29
|
+
# Differentiate between standard servers and ARM instances
|
|
30
|
+
if cpu =~ /arm64|aarch64/i
|
|
31
|
+
File.join(GEM_ROOT, "assets", "linux-arm64",
|
|
32
|
+
"pagefind")
|
|
33
|
+
else
|
|
34
|
+
File.join(GEM_ROOT, "assets", "linux-x64", "pagefind")
|
|
35
|
+
end
|
|
36
|
+
# spellchecker:disable-next-line
|
|
37
|
+
when /mswin|msys|mingw|cygwin|bccwin/i
|
|
38
|
+
# Differentiate between Intel/AMD and ARM Windows machines
|
|
39
|
+
if cpu =~ /arm64|aarch64/i
|
|
40
|
+
File.join(GEM_ROOT, "assets", "windows-arm64", "pagefind.exe")
|
|
41
|
+
else
|
|
42
|
+
File.join(GEM_ROOT, "assets", "windows-x64", "pagefind.exe")
|
|
43
|
+
end
|
|
44
|
+
else
|
|
45
|
+
raise "Jekyll-Pagefind Mismatch Error: Pagefind binary not provided for host environment: #{os} (#{cpu})"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# valid the cli flag
|
|
50
|
+
def self.valid_arg?(arg)
|
|
51
|
+
%w[output_subdir exclude_selectors keep_index_url quiet].include?(arg)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Converts Jekyll config options into matching Pagefind command line flags
|
|
55
|
+
def self.build_cli_arguments(config) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity
|
|
56
|
+
plugin_config = config["jekyll_pagefind"] || {}
|
|
57
|
+
args = []
|
|
58
|
+
|
|
59
|
+
plugin_config.each do |key, value|
|
|
60
|
+
next unless valid_arg?(key)
|
|
61
|
+
|
|
62
|
+
# Transform snake_case keys to kebab-case (e.g., keep_index_url -> keep-index-url)
|
|
63
|
+
flag_name = key.to_s.gsub("_", "-")
|
|
64
|
+
|
|
65
|
+
case value
|
|
66
|
+
when TrueClass
|
|
67
|
+
# Boolean flags like --keep-index-url require no attached value
|
|
68
|
+
args << "--#{flag_name}"
|
|
69
|
+
when FalseClass
|
|
70
|
+
# Ignore false booleans unless Pagefind specifically supports a negative override
|
|
71
|
+
next
|
|
72
|
+
when Array
|
|
73
|
+
# Arrays like exclude_selectors need to be repeated: --exclude-selectors ".footer" --exclude-selectors "nav"
|
|
74
|
+
value.each { |val| args << "--#{flag_name} \"#{val}\"" }
|
|
75
|
+
else
|
|
76
|
+
# Strings or numbers like --bundle-dir "search"
|
|
77
|
+
args << "--#{flag_name} \"#{value}\""
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
args.join(" ")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def self.run_pagefind(site_destination, extra_arguments = "") # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
|
84
|
+
binary = pagefind_binary_path
|
|
85
|
+
|
|
86
|
+
# Force execution bits on UNIX hosts because gem unpacking can reset permissions flags
|
|
87
|
+
# spellchecker:disable-next-line
|
|
88
|
+
if RbConfig::CONFIG["host_os"] !~ /mswin|msys|mingw|cygwin|bccwin/i && !File.executable?(binary)
|
|
89
|
+
File.chmod(0o755, binary)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Combine the mandatory --site parameter with any user-defined configuration flags
|
|
93
|
+
full_command = [
|
|
94
|
+
Shellwords.escape(binary),
|
|
95
|
+
"--site",
|
|
96
|
+
Shellwords.escape(site_destination),
|
|
97
|
+
extra_arguments
|
|
98
|
+
].join(" ").strip
|
|
99
|
+
started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
100
|
+
|
|
101
|
+
Jekyll.logger.info "Jekyll-Pagefind:", "Running Pagefind..."
|
|
102
|
+
_stdout, stderr, status = Open3.capture3(full_command)
|
|
103
|
+
|
|
104
|
+
if status.success?
|
|
105
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started_at
|
|
106
|
+
Jekyll.logger.info "Jekyll-Pagefind:", format("Done in %.2fs", elapsed)
|
|
107
|
+
else
|
|
108
|
+
Jekyll.logger.error "Jekyll-Pagefind Error:", stderr
|
|
109
|
+
raise "Pagefind binary exited with non-zero status code: #{status.exitstatus}"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Hook ensures Jekyll is entirely done writing HTML pages to disk
|
|
116
|
+
Jekyll::Hooks.register :site, :post_write do |site|
|
|
117
|
+
# Parse plugin settings out of site.config
|
|
118
|
+
custom_flags = Jekyll::Pagefind.build_cli_arguments(site.config)
|
|
119
|
+
# Run Pagefind with the compiled flags
|
|
120
|
+
Jekyll::Pagefind.run_pagefind(site.dest, custom_flags)
|
|
121
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll-pagefind
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.3.3
|
|
5
|
+
platform: x86_64-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- phothinmg
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-06-08 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: jekyll
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.4'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '4.4'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: open3
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.2.1
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.2.1
|
|
41
|
+
description: Run pagefind binary in jekyll site
|
|
42
|
+
email:
|
|
43
|
+
- phothinmg@disroot.org
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- LICENSE.txt
|
|
49
|
+
- README.md
|
|
50
|
+
- assets/linux-x64/pagefind
|
|
51
|
+
- jekyll-pagefind.gemspec
|
|
52
|
+
- lib/jekyll-pagefind.rb
|
|
53
|
+
- lib/version.rb
|
|
54
|
+
homepage: https://rubygems.org/gems/jekyll-pagefind
|
|
55
|
+
licenses:
|
|
56
|
+
- MIT
|
|
57
|
+
metadata:
|
|
58
|
+
rubygems_mfa_required: 'true'
|
|
59
|
+
homepage_uri: https://rubygems.org/gems/jekyll-pagefind
|
|
60
|
+
source_code_uri: https://github.com/phothinmg/jekykll-pagefind
|
|
61
|
+
changelog_uri: https://github.com/phothinmg/jekykll-pagefind/blob/main/CHANGELOG.md
|
|
62
|
+
post_install_message:
|
|
63
|
+
rdoc_options: []
|
|
64
|
+
require_paths:
|
|
65
|
+
- lib
|
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 3.1.0
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
requirements: []
|
|
77
|
+
rubygems_version: 3.4.19
|
|
78
|
+
signing_key:
|
|
79
|
+
specification_version: 4
|
|
80
|
+
summary: Pagefind plugin for Jekyll
|
|
81
|
+
test_files: []
|