Skip to content

Commit

Permalink
Add fuse.js as default
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Mar 2, 2025
1 parent a3c9c29 commit 6375486
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Contains basic configuration to get you a site with:
- [Github Action](.github/workflows/) for deploying the site.
- Demo page with the different Bootstrap components and how they look with the actual skin settings.
- Sample 404 page.
- Site search with Lunr.
- Site search with Fuse.js.
- Sample [`_config`](_config.yml) with minimal configuration.
- Sample [`algolia-search.yml`](algolia-search.yml) for using Algolia+GitHub Actions. More guidance in the top of the file.
- Sample files for extending the theme with your [own scripts](./_includes/custom/) and [css](./assets/css/).
Expand Down
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ analytics_id :
# - algolia v4 https://www.algolia.com/ - needs further configuration
# - google custom search engine https://cse.google.es/
# - Simple Jekyll Search https://github.com/christian-fei/Simple-Jekyll-Search
# - Fuse.js https://fusejs.io/
search:
provider : lunr #Select a provider for enable search: lunr, algolia, simplesearch
provider : fusejs #Select a provider for enable search: lunr, algolia, simplesearch, fusejs
label : #default ["Search"] Text on navbar when search is enabled
landing_page : #default ["/search"] Link on navbar
lunr_maxwords : #default [30] lunr only - May slow down your site build
simplesearch_maxwords : #default [30] simplesearch only - May slow down your site build
fusejs_maxwords : #default [30] fusejs only - May slow down your site build
algolia_logo : true #Displays algolia logo. Should be set to true if you are on a community plan, otherwise false.

google_cse_id: #Your cse id
Expand Down
76 changes: 42 additions & 34 deletions _pages/404.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
layout: minimal
title: 404
subtitle: Page not found
Expand All @@ -9,36 +9,39 @@ robots: noindex
sitemap: false
reload: true
---

<div class="my-auto text-center">
<h1 {% if site.search.provider %}{%else%}class="display-1 font-weight-bold" {% endif %}>4<i class="fa fa-times-circle"></i>4</h1>
<h2>{{ page.subtitle }}</h2>
<h1 {% if site.search.provider %}{% else %}class="display-1 font-weight-bold" {% endif %}>4<i class="fa fa-times-circle"></i>4</h1>
<h2>{{ page.subtitle }}</h2>
</div>

<main class="container-lg pt-2 pb-5 {% if site.search.provider %}flex-fill{% endif %}">
<!-- (c) Ben Balter https://ben.balter.com/2022/06/30/helpful-404s-for-jekyll-and-github-pages/ -->
<div class="row">
<div class="col-md-8 offset-md-2 my-0 text-center">
<div class="alert alert-warning text-center" role="alert">
<p class="font-weight-bold my-0 py-1">Perhaps you're looking for <span id="four-oh-four-suggestion"></span>?</p>
</div>
</div>
</div>
{% if site.search.provider %}
<div class="row">
<div class="col-lg-8 offset-lg-2 my-auto text-center">
<p class="lead font-weight-bold">{{ site.search.label | default: 'Search' }} <i class="fa fa-search" aria-hidden="true"></i></p>
{%- if site.search.provider == "lunr" -%}
{%- include search/lunr.html -%}
{% elsif site.search.provider == "google" %}
{%- include search/google.html -%}
{% elsif site.search.provider == "algolia" %}
{%- include search/algolia.html -%}
{% elsif site.search.provider == "simplesearch" %}
{%- include search/simplesearch.html -%}
{%- endif -%}
</div>
</div>
{% endif %}
<!-- (c) Ben Balter https://ben.balter.com/2022/06/30/helpful-404s-for-jekyll-and-github-pages/ -->
<div class="row">
<div class="col-md-8 offset-md-2 my-0 text-center">
<div class="alert alert-warning text-center" role="alert">
<p class="font-weight-bold my-0 py-1">Perhaps you're looking for <span id="four-oh-four-suggestion"></span>?</p>
</div>
</div>
</div>
{% if site.search.provider %}
<div class="row">
<div class="col-lg-8 offset-lg-2 my-auto text-center">
<p class="lead font-weight-bold">{{ site.search.label | default: 'Search' }} <i class="fa fa-search" aria-hidden="true"></i></p>
{%- if site.search.provider == "lunr" -%}
{%- include search/lunr.html -%}
{% elsif site.search.provider == "google" %}
{%- include search/google.html -%}
{% elsif site.search.provider == "algolia" %}
{%- include search/algolia.html -%}
{% elsif site.search.provider == "simplesearch" %}
{%- include search/simplesearch.html -%}
{% elsif site.search.provider == "fusejs" %}
{%- include search/fusejs.html -%}
{%- endif -%}
</div>
</div>
{% endif %}
</main>

<script src="{{ '/assets/js/better404/better404.js' | absolute_url }}"></script>
Expand All @@ -49,24 +52,29 @@ reload: true
{% endif %}

{%- if site.search.provider == "lunr" -%}
<style>
<style>
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300&display=swap');

.lunr{
font-family: 'Heebo', sans-serif;
background-color: black;
color: white;
.lunr {
font-family: 'Heebo', sans-serif;
background-color: black;
color: white;
}
</style>
</style>
<script src="https://unpkg.com/lunr/lunr.min.js"></script>
<script src="{{ '/assets/js/lunr/lunr-store.js' | absolute_url }}"></script>
<script src="{{ '/assets/js/lunr/lunr-search.js' | absolute_url }}"></script>
{% endif %}
{%- if site.search.provider == "algolia" -%}
<script src="https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
<script src="{{ '/assets/js/algolia/algolia-search.js' | absolute_url }}"></script>
{% endif %}
{%- if site.search.provider == "google" -%}
<script src="{{ '/assets/js/google/google-search.js' | absolute_url }}"></script>
{% endif %}
{%- if site.search.provider == "fusejs" -%}
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="{{ '/assets/js/fusejs/fusejs-store.js' | absolute_url }}"></script>
<script src="{{ '/assets/js/fusejs/fusejs-search.js' | absolute_url }}"></script>
{% endif %}

0 comments on commit 6375486

Please sign in to comment.