@apify/docs-theme 1.0.76 → 1.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/theme/SearchPage/index.js +15 -11
package/package.json
CHANGED
|
@@ -55,7 +55,10 @@ function useDocsSearchVersionsHelpers() {
|
|
|
55
55
|
),
|
|
56
56
|
);
|
|
57
57
|
// Set the value of a single select menu
|
|
58
|
-
const setSearchVersion = (pluginId, searchVersion) => setSearchVersions((s) => ({
|
|
58
|
+
const setSearchVersion = (pluginId, searchVersion) => setSearchVersions((s) => ({
|
|
59
|
+
...s,
|
|
60
|
+
[pluginId]: searchVersion,
|
|
61
|
+
}));
|
|
59
62
|
const versioningEnabled = Object.values(allDocsData).some(
|
|
60
63
|
(docsData) => docsData.versions.length > 1,
|
|
61
64
|
);
|
|
@@ -109,9 +112,7 @@ function SearchVersionSelectList({ docsSearchVersionsHelpers }) {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
function SearchPageContent() {
|
|
112
|
-
const {
|
|
113
|
-
i18n: { currentLocale },
|
|
114
|
-
} = useDocusaurusContext();
|
|
115
|
+
const { siteConfig, i18n: { currentLocale } } = useDocusaurusContext();
|
|
115
116
|
const {
|
|
116
117
|
algolia: { appId, apiKey, indexName },
|
|
117
118
|
} = useAlgoliaThemeConfig();
|
|
@@ -183,15 +184,18 @@ function SearchPageContent() {
|
|
|
183
184
|
);
|
|
184
185
|
const items = hits.map(
|
|
185
186
|
({
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
url,
|
|
188
|
+
_highlightResult: { hierarchy },
|
|
189
|
+
_snippetResult: snippet = {},
|
|
190
|
+
}) => {
|
|
191
|
+
if (url.startsWith(siteConfig.url)) {
|
|
192
|
+
url = url.substring(siteConfig.url.length);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const titles = Object.keys(hierarchy).map((key) => sanitizeValue(hierarchy[key].value));
|
|
192
196
|
return {
|
|
193
197
|
title: titles.pop(),
|
|
194
|
-
url
|
|
198
|
+
url,
|
|
195
199
|
summary: snippet.content
|
|
196
200
|
? `${sanitizeValue(snippet.content.value)}...`
|
|
197
201
|
: '',
|