Skip to content

Commit 9d8f504

Browse files
committed
updated algolia config
1 parent bec41e7 commit 9d8f504

File tree

2 files changed

+212
-12
lines changed

2 files changed

+212
-12
lines changed

docusaurus.config.js

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -709,20 +709,68 @@ const config = {
709709
},
710710
},
711711
algolia: {
712+
// Your Algolia credentials
712713
appId: 'KPMSCF6G6J',
713-
apiKey: '1b20f30f13a874cd46f9d5c30b01d99c',
714-
indexName: 'product_docs',
715-
searchPagePath: false,
716-
placeholder: 'Search the Netwrix docs',
717-
contextualSearch: false,
714+
apiKey: '1b20f30f13a874cd46f9d5c30b01d99c', // Use the search-only API key, not the admin key
715+
indexName: 'Production Docs',
716+
717+
// Enable contextual search (already great that you have product/version meta tags!)
718+
contextualSearch: true,
719+
720+
// Search parameters for better results
718721
searchParameters: {
719-
// Define which attributes should be available as facets
720-
attributesToRetrieve: ['*'],
721-
facets: ['product', 'version'],
722+
// Facet filters can be combined with contextual search
723+
// These will be merged with the automatic facets from contextual search
724+
facetFilters: [
725+
// Add any default filters here if needed
726+
// e.g., 'type:content' to exclude headers-only results
727+
],
728+
729+
// Attributes to snippet in search results
730+
attributesToSnippet: ['content:20'],
731+
732+
// Highlight search terms in results
733+
highlightPreTag: '<mark>',
734+
highlightPostTag: '</mark>',
735+
736+
// Number of results per page
737+
hitsPerPage: 20,
738+
739+
// Add these for better relevance
740+
distinct: true,
741+
clickAnalytics: true,
742+
analytics: true,
743+
},
722744

723-
// Optional: Set default filters (these will be applied unless user changes them)
724-
facetFilters: [],
745+
// Enable search insights for better analytics
746+
insights: true,
747+
748+
// Path for the search page (enables full-page search experience)
749+
searchPagePath: 'search',
750+
751+
// Placeholder text for the search box
752+
placeholder: 'Search the Netwrix docs...',
753+
754+
// Transform items before displaying (optional)
755+
transformItems: (items) => {
756+
return items.map((item) => {
757+
// Add product badges or modify display as needed
758+
return {
759+
...item,
760+
// Example: Add custom badges based on product
761+
_highlightResult: {
762+
...item._highlightResult,
763+
// Customize highlighted results if needed
764+
},
765+
};
766+
});
725767
},
768+
769+
// Replace paths if you're using different deployments
770+
// replaceSearchResultPathname: {
771+
// from: '/docs/',
772+
// to: '/',
773+
// },
726774
},
727775
navbar: {
728776
logo: {
@@ -754,6 +802,17 @@ const config = {
754802
darkTheme: prismThemes.dracula,
755803
},
756804
}),
805+
// Add preconnect for better search performance
806+
headTags: [
807+
{
808+
tagName: 'link',
809+
attributes: {
810+
rel: 'preconnect',
811+
href: 'https://KPMSCF6G6J-dsn.algolia.net',
812+
crossorigin: 'anonymous',
813+
},
814+
},
815+
],
757816
stylesheets: ['https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap'],
758817
};
759818

src/css/custom.css

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
--ifm-color-primary-lightest: #4169c4;
1616
--ifm-code-font-size: 95%;
1717
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
18-
--ifm-font-family-base:
19-
'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
18+
--ifm-font-family-base: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
2019
}
2120

2221
/* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -207,3 +206,145 @@ html {
207206
[data-theme='dark'] img {
208207
border-color: #3a3a3a;
209208
}
209+
210+
/* Add this to your /src/css/custom.css file */
211+
212+
/* Algolia DocSearch Custom Styling */
213+
/* Using CSS variables for better theme integration */
214+
215+
[data-theme='light'] .DocSearch {
216+
--docsearch-primary-color: var(--ifm-color-primary);
217+
--docsearch-text-color: var(--ifm-font-color-base);
218+
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
219+
--docsearch-container-background: rgba(94, 100, 112, 0.7);
220+
221+
/* Modal */
222+
--docsearch-modal-background: var(--ifm-color-secondary-lighter);
223+
224+
/* Search box */
225+
--docsearch-searchbox-background: var(--ifm-color-secondary);
226+
--docsearch-searchbox-focus-background: var(--ifm-color-white);
227+
228+
/* Hit */
229+
--docsearch-hit-color: var(--ifm-font-color-base);
230+
--docsearch-hit-active-color: var(--ifm-color-white);
231+
--docsearch-hit-background: var(--ifm-color-white);
232+
233+
/* Footer */
234+
--docsearch-footer-background: var(--ifm-color-white);
235+
}
236+
237+
[data-theme='dark'] .DocSearch {
238+
--docsearch-text-color: var(--ifm-font-color-base);
239+
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
240+
--docsearch-container-background: rgba(47, 55, 69, 0.7);
241+
242+
/* Modal */
243+
--docsearch-modal-background: var(--ifm-background-color);
244+
245+
/* Search box */
246+
--docsearch-searchbox-background: var(--ifm-background-color);
247+
--docsearch-searchbox-focus-background: var(--ifm-color-black);
248+
249+
/* Hit */
250+
--docsearch-hit-color: var(--ifm-font-color-base);
251+
--docsearch-hit-active-color: var(--ifm-color-white);
252+
--docsearch-hit-background: var(--ifm-color-emphasis-100);
253+
254+
/* Footer */
255+
--docsearch-footer-background: var(--ifm-background-surface-color);
256+
--docsearch-key-gradient: linear-gradient(-26.5deg, var(--ifm-color-emphasis-200) 0%, var(--ifm-color-emphasis-100) 100%);
257+
}
258+
259+
/* Custom enhancements for better UX */
260+
.DocSearch-Button {
261+
/* Make the search button more prominent */
262+
margin: 0 12px;
263+
padding: 0 16px;
264+
font-weight: 500;
265+
}
266+
267+
/* Highlight product and version info in search results */
268+
.DocSearch-Hit[aria-selected='true'] .DocSearch-Hit-hierarchy {
269+
font-weight: 600;
270+
}
271+
272+
/* Style the product > version breadcrumb in results */
273+
.DocSearch-Hit-hierarchy .DocSearch-Hit-lvl0 {
274+
color: var(--docsearch-primary-color);
275+
font-weight: 600;
276+
}
277+
278+
/* Add visual separation for different product sections */
279+
.DocSearch-Hits ul {
280+
margin: 0;
281+
}
282+
283+
/* Improve readability of search snippets */
284+
.DocSearch-Hit-content {
285+
line-height: 1.5;
286+
font-size: 0.875rem;
287+
}
288+
289+
/* Highlight search terms more prominently */
290+
.DocSearch-Hit-content mark {
291+
background-color: var(--ifm-color-primary-lighter);
292+
color: var(--ifm-font-color-base);
293+
font-weight: 600;
294+
padding: 0 2px;
295+
}
296+
297+
/* Add product/version badges if needed */
298+
.DocSearch-Hit-content-wrapper {
299+
position: relative;
300+
}
301+
302+
/* Responsive improvements */
303+
@media (max-width: 768px) {
304+
.DocSearch-Button-Keys {
305+
display: none;
306+
}
307+
308+
.DocSearch-Button {
309+
padding: 0 12px;
310+
}
311+
}
312+
313+
/* Optional: Add custom icons for different content types */
314+
.DocSearch-Hit-icon {
315+
color: var(--docsearch-muted-color);
316+
}
317+
318+
/* Style the search page if you're using searchPagePath */
319+
.search-page {
320+
min-height: 70vh;
321+
padding: 2rem;
322+
}
323+
324+
.search-page .DocSearch-Container {
325+
position: relative;
326+
background: transparent;
327+
}
328+
329+
/* Add smooth transitions */
330+
.DocSearch-Hit {
331+
transition: background-color 0.2s ease;
332+
}
333+
334+
/* Custom scrollbar for search results */
335+
.DocSearch-Dropdown::-webkit-scrollbar {
336+
width: 12px;
337+
}
338+
339+
.DocSearch-Dropdown::-webkit-scrollbar-track {
340+
background: var(--docsearch-modal-background);
341+
}
342+
343+
.DocSearch-Dropdown::-webkit-scrollbar-thumb {
344+
background: var(--docsearch-muted-color);
345+
border-radius: 6px;
346+
}
347+
348+
.DocSearch-Dropdown::-webkit-scrollbar-thumb:hover {
349+
background: var(--docsearch-primary-color);
350+
}

0 commit comments

Comments
 (0)