Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding site search #430

Open
floehopper opened this issue Jun 3, 2024 · 2 comments
Open

Consider adding site search #430

floehopper opened this issue Jun 3, 2024 · 2 comments

Comments

@floehopper
Copy link
Member

@threedaymonk & @tomstuart have both used https://pagefind.app/ on their personal sites, so that might be worth a try.

@tomstuart
Copy link
Contributor

tomstuart commented Jun 3, 2024

In case it helps, I added a little bit of processResult JavaScript to remove the .html from the end of the URLs in Pagefind’s search results, since I don’t ordinarily use that when I link to pages (i.e. I have permalink: :title in my Jekyll config):

<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<div id="search"></div>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    new PagefindUI({
      element: '#search',
      processResult: function (result) {
        result.url = result.url.replace(/\.html$/, '');
        return result;
      }
    });
  });
</script>

Good luck!

@floehopper
Copy link
Member Author

Thanks, @tom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants