Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 54 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"dotenv": "^16.5.0",
"eslint": "^9",
"eslint-config-next": "15.3.1",
"pagefind": "^1.3.0",
"pagefind": "^1.5.0",
"postcss": "^8.5.3",
"postcss-preset-mantine": "^1.17.0",
"postcss-simple-vars": "^7.0.1",
Expand Down
14 changes: 8 additions & 6 deletions src/components/SpotlightSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const SearchResult = ({
id={`${result.id}-${subIdx}`}
onClick={() => {
router.push(
subResult.url.replace(/(\/[^?#]+)\.html(?=[?#]|$)/, "$1")
subResult.url.replace(/(\/[^?#]+)\.html(?=[?#]|$)/, "$1"),
);
}}
>
Expand All @@ -83,7 +83,9 @@ const SearchResult = ({
opacity={0.7}
flex={2}
>
{decode(subResult.excerpt.replace(/<\/?mark>/g, ""))}
{/* We use plain_excerpt instead of excerpt since we do the highlighting ourselves,
see also https://github.com/Pagefind/pagefind/issues/815 */}
{decode(subResult.plain_excerpt)}
</Highlight>
</Group>
</Spotlight.Action>
Expand All @@ -95,7 +97,7 @@ const SearchResult = ({
type PagefindSubResult = {
title: string;
url: string;
excerpt: string;
plain_excerpt: string;
anchor?: {
element: string;
id: string;
Expand All @@ -107,7 +109,7 @@ type PagefindSubResult = {
type PagefindResultData = {
url: string;
content: string;
excerpt: string;
plain_excerpt: string;
meta: {
title: string;
breadcrumbs?: string;
Expand Down Expand Up @@ -151,15 +153,15 @@ export default function SpotlightSearch() {
Promise.resolve({
url: "",
content: "",
excerpt: "",
plain_excerpt: "",
meta: {
title: `Error importing pagefind.js`,
},
sub_results: [
{
title: "Error",
url: "",
excerpt: `NOTE: Search only works with a static build, not in dev mode. Error: ${e}`,
plain_excerpt: `NOTE: Search only works with a static build, not in dev mode. Error: ${e}`,
},
],
}),
Expand Down
Loading