From 6375486ff8b34fad8d2c8e35769cec86b64f4650 Mon Sep 17 00:00:00 2001 From: "Diego H." Date: Mon, 3 Mar 2025 00:39:38 +0100 Subject: [PATCH] Add fuse.js as default --- README.md | 2 +- _config.yml | 4 ++- _pages/404.md | 76 ++++++++++++++++++++++++++++----------------------- 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9313d36..3d5be93 100644 --- a/README.md +++ b/README.md @@ -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/). diff --git a/_config.yml b/_config.yml index 6cdc657..5646fed 100644 --- a/_config.yml +++ b/_config.yml @@ -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 diff --git a/_pages/404.md b/_pages/404.md index 38db14d..765790c 100644 --- a/_pages/404.md +++ b/_pages/404.md @@ -1,4 +1,4 @@ ---- +--- layout: minimal title: 404 subtitle: Page not found @@ -9,36 +9,39 @@ robots: noindex sitemap: false reload: true --- +
-

44

-

{{ page.subtitle }}

+

44

+

{{ page.subtitle }}

- -
-
- -
-
- {% if site.search.provider %} -
-
-

{{ site.search.label | default: 'Search' }}

- {%- 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 -%} -
-
- {% endif %} + +
+
+ +
+
+ {% if site.search.provider %} +
+
+

{{ site.search.label | default: 'Search' }}

+ {%- 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 -%} +
+
+ {% endif %}
@@ -49,24 +52,29 @@ reload: true {% endif %} {%- if site.search.provider == "lunr" -%} - + {% endif %} {%- if site.search.provider == "algolia" -%} - + {% endif %} {%- if site.search.provider == "google" -%} {% endif %} +{%- if site.search.provider == "fusejs" -%} + + + +{% endif %}