@apify/docs-theme 1.0.75 → 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
CHANGED
|
@@ -5,7 +5,6 @@ import algoliaSearchHelper from 'algoliasearch-helper';
|
|
|
5
5
|
import algoliaSearch from 'algoliasearch/lite';
|
|
6
6
|
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|
7
7
|
import Head from '@docusaurus/Head';
|
|
8
|
-
import Link from '@docusaurus/Link';
|
|
9
8
|
import { useAllDocsData } from '@docusaurus/plugin-content-docs/client';
|
|
10
9
|
import {
|
|
11
10
|
HtmlClassNameProvider,
|
|
@@ -23,6 +22,7 @@ import {
|
|
|
23
22
|
useSearchResultUrlProcessor,
|
|
24
23
|
} from '@docusaurus/theme-search-algolia/client';
|
|
25
24
|
import Layout from '@theme/Layout';
|
|
25
|
+
import { A } from '../SearchBar';
|
|
26
26
|
import styles from './styles.module.css';
|
|
27
27
|
|
|
28
28
|
// Very simple pluralization: probably good enough for now
|
|
@@ -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
|
: '',
|
|
@@ -382,7 +386,7 @@ function SearchPageContent() {
|
|
|
382
386
|
({ title, url, summary, breadcrumbs }, i) => (
|
|
383
387
|
<article key={i} className={styles.searchResultItem}>
|
|
384
388
|
<h2 className={styles.searchResultItemHeading}>
|
|
385
|
-
<
|
|
389
|
+
<A href={url} dangerouslySetInnerHTML={{ __html: title }}/>
|
|
386
390
|
</h2>
|
|
387
391
|
|
|
388
392
|
{breadcrumbs.length > 0 && (
|