diff options
| author | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-01 19:53:46 +0200 |
|---|---|---|
| committer | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-01 19:53:46 +0200 |
| commit | 5c407433477a98f5a00c63062a96e6d816a9f73b (patch) | |
| tree | 14b23adbd903d7984bac9f43ad640e0433e6cb2a /themes | |
| parent | 620ef13b0032dfcc7d4d76def8e7e1ac9501f95d (diff) | |
| download | mitjafelicijan.com-5c407433477a98f5a00c63062a96e6d816a9f73b.tar.gz | |
Added cachebusting to search index
Diffstat (limited to 'themes')
| -rw-r--r-- | themes/simple/layouts/partials/search.html | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/themes/simple/layouts/partials/search.html b/themes/simple/layouts/partials/search.html index adf2cfb..f157f03 100644 --- a/themes/simple/layouts/partials/search.html +++ b/themes/simple/layouts/partials/search.html | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | {{ $cachebuster := delimit (shuffle (split (md5 "6fab11c6669976d759d2992eff1dd5be") "" )) "" }} | ||
| 2 | |||
| 1 | <section class="search-modal mb-10 hidden"> | 3 | <section class="search-modal mb-10 hidden"> |
| 2 | <input class="bg-gray-100 w-full px-3 py-2 rounded outline-none" type="search" placeholder="Search here..."> | 4 | <input class="bg-gray-100 w-full px-3 py-2 rounded outline-none" type="search" placeholder="Search here..."> |
| 3 | <section class="results bg-white border border-gray-200 shadow-md p-2 flex flex-col gap-2 rounded mt-4 hidden"></section> | 5 | <section class="results bg-white border border-gray-200 shadow-md p-2 flex flex-col gap-2 rounded mt-4 hidden"></section> |
| @@ -10,7 +12,7 @@ | |||
| 10 | const maxSearchResults = 10; | 12 | const maxSearchResults = 10; |
| 11 | 13 | ||
| 12 | // Fetch search index generated by Hugo. | 14 | // Fetch search index generated by Hugo. |
| 13 | const req = await fetch('/index.json'); | 15 | const req = await fetch('/index.json?v={{ $cachebuster }}'); |
| 14 | window.searchDocuments = await req.json(); | 16 | window.searchDocuments = await req.json(); |
| 15 | 17 | ||
| 16 | window.searchIndex = lunr(function() { | 18 | window.searchIndex = lunr(function() { |
