All repositories

astro-lunr

License

Lunr integration for Astro; client-side search for statically hosted pages.

2022-05-14 17:06 #1: fixed base path replacement problem
Siver K. Volle 3f44311
2022-05-14 17:06 #1: fixed base path replacement problem master Siver K. Volle 3f44311
2022-05-01 13:57 Fixed problem with import.meta.env when proper npm-module Siver K. Volle 00a915f
2022-04-18 20:31 add demo-link to readme Siver K. Volle d930b81
2022-04-18 19:51 initial steps to turn astro-lunr into its own repo Siver K. Volle 9983ab3
2022-04-18 18:39 better lunr in dev-mode; better file diffs Siver K. Volle 182546c
2022-04-17 19:29 support for github pages; max-lines in file view Siver K. Volle 1612826
2022-04-16 00:25 Included readme and licenses; made the plugins into npm-modules; removed more dead-links and ui/ux-bugs Siver K. Volle 077a354
2022-04-15 17:21 Multi-repo support; refactored astro-git and astro-lunr into independent plugins Siver K. Volle adfedbe
2022-04-14 10:00 lunr-based indexing and search integration; assorted minor ux/ui improvements Siver K. Volle 146ebb5

Differences for commit 1612826e03ec07e2d6b6dd961749e8dc18c8f5c4

client/lunr.js | +4L -3L 13% changed
to file
0 import lunr from 'lunr';
1
2 const LUNR_DIR = import.meta.env.PUBLIC_LUNR_DIR || "";
3 + const BASE_URL = import.meta.env.PUBLIC_BASE_URL || "/";
4
5 function join(...path){
6 - return path.filter(Boolean).join("/");
7 + return path.filter(Boolean).join("/").replace(/\/+/g, "/");
8 }
9
10 let idxMap = new Map();
11 export async function getIndex(index = ""){
12 if(!idxMap.has(index)){
13 - let response = await fetch(join(LUNR_DIR, index, "idx.json"));
14 + let response = await fetch(join(BASE_URL, LUNR_DIR, index, "idx.json"));
15 if(response.status !== 200){
16 throw new Error(`Astro-lunr: idx.json not found for index=${index}`);
...
25 export async function getDocs(index = ""){
26 if(!docMap.has(index)){
27 - let response = await fetch(join(LUNR_DIR, index, "docs.json"));
28 + let response = await fetch(join(BASE_URL, LUNR_DIR, index, "docs.json"));
29 if(response.status !== 200){
30 throw new Error(`Astro-lunr: docs.json not found for index=${index}`);
...
52 }
53 })