Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
{% include_cached search/google-search-scripts.html %}
{%- when "algolia" -%}
{% include_cached search/algolia-search-scripts.html %}
{%- when "pagefind" -%}
{% include_cached search/pagefind-search-scripts.html %}
{%- endcase -%}
{% endif %}

Expand Down
2 changes: 2 additions & 0 deletions _includes/search/pagefind-search-scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<link href="{{ "/pagefind/pagefind-ui.css" | relative_url }}" rel="stylesheet">
<script src="{{ "/pagefind/pagefind-ui.js" | relative_url }}"></script>
7 changes: 7 additions & 0 deletions _includes/search/search_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@
{%- when "algolia" -%}
<div class="search-searchbar"></div>
<div class="search-hits"></div>
{%- when "pagefind" -%}
<div id="search"></div>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", showSubResults: true });
});
</script>
{%- endcase -%}
</div>
12 changes: 12 additions & 0 deletions docs/_docs/05-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,18 @@ Add a Google search box to your site.
**Note:** If your site is new and hasn't been indexed by Google yet, search will be incomplete and won't provide accurate results.
{: .notice--info}

#### Pagefind from Cloudcannon

You can use [Pagefind](https://pagefind.app/) to add search for you static site also.

First you build your site like normal, and then afterwards you run the following command.

```bash
npx -y pagefind --site public
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the default output directory really public for Jekyll?

```

It is important that you run the script after you have build your site (and everytime you rebuild). You can read more in the [Pagefind docs](https://pagefind.app/docs/).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either "you have built" or "you build". This is currently wrong English grammar.


### SEO, social sharing, and analytics settings

All optional, but a good idea to take the time setting up to improve SEO and links shared from the site.
Expand Down