jekyll-pagefind 0.3.1-x86_64-linux

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 020eafea9b1a718af7ecc409269efaf7c700ba2a765b07f43a2f05c3c3a74354
4
+ data.tar.gz: 7cb10dcc68deb11fc4709868c666590f8d1c46a27ca24ad7fded262d952df0b0
5
+ SHA512:
6
+ metadata.gz: 5de94bf3aee9cbb44ebd0ba618188c32e61824d449a39f8949e30333ce114979e9c7f5331f28361b5c2b25541cf54a6d32d0b1573f5dcf707fb3397ea0842cda
7
+ data.tar.gz: 4392bdab72278743811558b08bef350511d36827270eb578c495082145ce608b2f9307e3f7fbf11d24b0ca53186439808ca9211b61363c283126cf9bd53d3573
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,232 @@
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
+ [![Gem Version](https://badge.fury.io/rb/jekyll-pagefind.svg?icon=si%3Arubygems)](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
+
43
+ ## Use
44
+
45
+ ### Jekyll site configuration
46
+
47
+ **`_config.yml`**
48
+
49
+ ```yaml
50
+ plugins:
51
+ # other plugin
52
+ - jekyll-pagefind
53
+ # other config
54
+ # Optional Jekyll Pagefind Options
55
+ jekyll_pagefind:
56
+ output_subdir: pagefind
57
+ ```
58
+
59
+ ---
60
+
61
+ ### Jekyll Pagefind options (optional)
62
+
63
+ 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).
64
+
65
+ For more details, see [Pagefind CLI configuration options](https://pagefind.app/docs/config-options/). `jekyll_pagefind` supports the following options.
66
+
67
+ #### 1. output_subdir
68
+
69
+ The folder where the search bundle is written, relative to Jekyll `{{ site.dest }}`. The default is `pagefind`.
70
+
71
+ **Example:**
72
+
73
+ ```yaml
74
+ output_subdir: pf # becomes _site/pf
75
+ ```
76
+
77
+ #### 2. exclude_selectors
78
+
79
+ Pass extra element selectors that Pagefind should ignore when indexing.
80
+
81
+ **Example :**
82
+
83
+ ```yaml
84
+ exclude_selectors:
85
+ - "#my_navigation"
86
+ - "blockquote > span"
87
+ - "[id^='prefix-']"
88
+ ```
89
+
90
+ #### 3. keep_index_url
91
+
92
+ Keeps `index.html` at the end of search result paths. The default is `false`.
93
+
94
+ 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`.
95
+
96
+ #### 4. quiet
97
+
98
+ Logs only errors and warnings while indexing the site.
99
+
100
+ ---
101
+
102
+ ### Pagefind UI
103
+
104
+ #### 1. Using the Default UI
105
+
106
+ Using the Default UI is still supported, but it is no longer Pagefind's primary recommendation.
107
+
108
+ 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.
109
+
110
+ ```liquid
111
+ <script src="{{ '/pagefind/pagefind-ui.js' | relative_url }}"></script>
112
+ <link rel="stylesheet" href="{{ '/pagefind/pagefind-ui.css' | relative_url }}" />
113
+
114
+ <div id="search"></div>
115
+ <script>
116
+ window.addEventListener('DOMContentLoaded', (event) => {
117
+ new PagefindUI({ element: "#search", showSubResults: true });
118
+ });
119
+ </script>
120
+ ```
121
+
122
+ For dark mode:
123
+
124
+ ```css
125
+ body.dark {
126
+ --pagefind-ui-primary: #eeeeee;
127
+ --pagefind-ui-text: #eeeeee;
128
+ --pagefind-ui-background: #152028;
129
+ --pagefind-ui-border: #152028;
130
+ --pagefind-ui-tag: #152028;
131
+ }
132
+ ```
133
+
134
+ For more details, see [Using the Default UI](https://pagefind.app/docs/ui-usage/).
135
+
136
+ #### 2. Pagefind Component UI
137
+
138
+ 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.
139
+
140
+ ```liquid
141
+ <script src="{{ '/pagefind/pagefind-component-ui.js' | relative_url }}" type="module"></script>
142
+ <link rel="stylesheet" href="{{ '/pagefind/pagefind-component-ui.css' | relative_url }}" />
143
+ ```
144
+
145
+ For dark mode:
146
+
147
+ ```html
148
+ <div data-pf-theme="dark">
149
+ <pagefind-searchbox></pagefind-searchbox>
150
+ </div>
151
+ ```
152
+
153
+ ```css
154
+ @media (prefers-color-scheme: dark) {
155
+ :root {
156
+ --pf-text: #e5e5e5;
157
+ --pf-text-secondary: #a0a0a0;
158
+ --pf-text-muted: #949494;
159
+ --pf-background: #1a1a1a;
160
+ --pf-border: #333;
161
+ --pf-border-focus: #555;
162
+ --pf-skeleton: #2a2a2a;
163
+ --pf-skeleton-shine: #333;
164
+ --pf-hover: #252525;
165
+ --pf-mark: #e5e5e5;
166
+ --pf-scroll-shadow: rgba(255, 255, 255, 0.1);
167
+ --pf-outline-focus: #58a6ff;
168
+
169
+ --pf-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
170
+ --pf-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
171
+ --pf-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
172
+
173
+ --pf-error-bg: #2a1a1a;
174
+ --pf-error-border: #5c2828;
175
+ --pf-error-text: #f87171;
176
+ --pf-error-text-secondary: #ef4444;
177
+ }
178
+ }
179
+ ```
180
+
181
+ For more details, see [Pagefind Component UI](https://pagefind.app/docs/search-ui/).
182
+
183
+ ---
184
+
185
+ ## Contributing
186
+
187
+ ## Maintainer Release Notes
188
+
189
+ This gem is published as platform-specific packages so users only download the binary for their host OS.
190
+
191
+ Build the current host variant:
192
+
193
+ ```sh
194
+ make build
195
+ ```
196
+
197
+ Run the fixture-based smoke test:
198
+
199
+ ```sh
200
+ make smoke-test
201
+ ```
202
+
203
+ Build every supported variant:
204
+
205
+ ```sh
206
+ make build-all
207
+ ```
208
+
209
+ Publish the built platform gems for a version:
210
+
211
+ ```sh
212
+ make publish
213
+ ```
214
+
215
+ `bin/build-platform-gems` currently maps these asset folders to RubyGems platforms:
216
+
217
+ - `assets/linux-x64` -> `x86_64-linux`
218
+ - `assets/linux-arm64` -> `aarch64-linux`
219
+ - `assets/macos-x64` -> `x86_64-darwin`
220
+ - `assets/macos-arm64` -> `arm64-darwin`
221
+ - `assets/windows-x64` -> `x64-mingw32`, `x64-mingw-ucrt`
222
+ - `assets/windows-arm64` -> `arm64-mingw32`, `arm64-mingw-ucrt`
223
+
224
+ 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).
225
+
226
+ ## License
227
+
228
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
229
+
230
+ ## Code of Conduct
231
+
232
+ 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,45 @@
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})"
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
+
23
+ Gem::Specification.new do |spec|
24
+ spec.name = "jekyll-pagefind"
25
+ spec.version = Jekyll::Pagefind::VERSION
26
+ spec.platform = Gem::Platform.new(pagefind_gem_platform)
27
+ spec.authors = ["phothinmg"]
28
+ spec.email = ["phothinmg@disroot.org"]
29
+
30
+ spec.summary = "Pagefind plugin for Jekyll"
31
+ spec.description = "Run pagefind binary in jekyll site"
32
+ spec.homepage = "https://rubygems.org/gems/jekyll-pagefind"
33
+ spec.license = "MIT"
34
+ spec.required_ruby_version = ">= 3.1.0"
35
+ spec.metadata["homepage_uri"] = spec.homepage
36
+ spec.metadata["source_code_uri"] = "https://github.com/phothinmg/jekykll-pagefind"
37
+ spec.metadata["changelog_uri"] = "https://github.com/phothinmg/jekykll-pagefind/blob/main/CHANGELOG.md"
38
+
39
+ spec.files = Dir.chdir(__dir__) do
40
+ Dir["README.md", "LICENSE.txt", "lib/**/*", "#{pagefind_asset_directory}/**/*", "jekyll-pagefind.gemspec"]
41
+ end
42
+ spec.require_paths = ["lib"]
43
+ spec.add_dependency "jekyll", "~> 4.4"
44
+ spec.add_dependency "open3", "~> 0.2.1"
45
+ 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_args(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_args(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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Pagefind
5
+ VERSION = "0.3.1"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-pagefind
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: x86_64-linux
6
+ authors:
7
+ - phothinmg
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '4.4'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '4.4'
26
+ - !ruby/object:Gem::Dependency
27
+ name: open3
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.1
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.2.1
40
+ description: Run pagefind binary in jekyll site
41
+ email:
42
+ - phothinmg@disroot.org
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - LICENSE.txt
48
+ - README.md
49
+ - assets/linux-x64/pagefind
50
+ - jekyll-pagefind.gemspec
51
+ - lib/jekyll-pagefind.rb
52
+ - lib/version.rb
53
+ homepage: https://rubygems.org/gems/jekyll-pagefind
54
+ licenses:
55
+ - MIT
56
+ metadata:
57
+ homepage_uri: https://rubygems.org/gems/jekyll-pagefind
58
+ source_code_uri: https://github.com/phothinmg/jekykll-pagefind
59
+ changelog_uri: https://github.com/phothinmg/jekykll-pagefind/blob/main/CHANGELOG.md
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 3.1.0
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubygems_version: 4.0.11
75
+ specification_version: 4
76
+ summary: Pagefind plugin for Jekyll
77
+ test_files: []