https://github.com/quexpl/pagefind
Mix task for installing and invoking pagefind
https://github.com/quexpl/pagefind
elixir pagefind searching static-website
Last synced: 4 months ago
JSON representation
Mix task for installing and invoking pagefind
- Host: GitHub
- URL: https://github.com/quexpl/pagefind
- Owner: quexpl
- License: mit
- Created: 2025-02-18T09:21:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-20T23:22:38.000Z (over 1 year ago)
- Last Synced: 2025-10-11T09:42:58.756Z (9 months ago)
- Topics: elixir, pagefind, searching, static-website
- Language: Elixir
- Homepage: https://hexdocs.pm/pagefind
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Pagefind
[](https://github.com/quexpl/pagefind/actions?query=workflow%3ACI)
[](https://hex.pm/packages/pagefind)
[](https://hexdocs.pm/pagefind)
Mix task for installing and invoking [pagefind](https://www.pagefind.app).
Heavily inspired by tailwind and esbuild.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `pagefind` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:pagefind, "~> 0.1.0"}
]
end
```
Once installed, change your `config/config.exs` and pick a version for the pagefind CLI of your choice:
```elixir
config :pagefind, version: "1.3.0"
```
Now you can install pagefind by running:
```
$ mix pagefind.install
```
And invoke pagefind with:
```
$ mix pagefind --site dist --output-subdir search --exclude-selectors "#my_navigation, blockquote > span, [id^='prefix-']"
```
The executable is kept at `_build/pagefind-TARGET`. Where `TARGET` is your system target architecture.
## Adding to Tableau
To add `pagefind` to an application using Tableau, you need only two steps:
First add a new extension which will trigger Pagefind in `lib/extensions/pagefind_extension.ex`:
```elixir
defmodule MyAapp.PagefindExtension do
use Tableau.Extension, enabled: true, type: :post_write, key: :search, priority: 500
def run(token) do
Pagefind.install_and_run([]);
{:ok, token}
end
end
```
Now let's change `config/config.exs` to configure `pagefind`:
```elixir
config :pagefind, version: "1.3.0", args: ["--site", "_site"]
```
That's all.
## License
Copyright (c) 2025 Piotr Baj.
pagefind source code is licensed under the [MIT License](LICENSE.md).