@docusaurus/theme-search-algolia 3.7.0 → 3.8.0-canary-6327
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.
|
@@ -190,6 +190,8 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
190
190
|
|
|
191
191
|
{isOpen &&
|
|
192
192
|
DocSearchModal &&
|
|
193
|
+
// TODO need to fix this React Compiler lint error
|
|
194
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
193
195
|
searchContainer.current &&
|
|
194
196
|
createPortal(
|
|
195
197
|
<DocSearchModal
|
|
@@ -208,6 +210,8 @@ function DocSearch({externalUrlRegex, ...props}) {
|
|
|
208
210
|
translations={props.translations?.modal ?? translations.modal}
|
|
209
211
|
searchParameters={searchParameters}
|
|
210
212
|
/>,
|
|
213
|
+
// TODO need to fix this React Compiler lint error
|
|
214
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
211
215
|
searchContainer.current,
|
|
212
216
|
)}
|
|
213
217
|
</>
|
|
@@ -15,11 +15,11 @@ import Link from '@docusaurus/Link';
|
|
|
15
15
|
import {useAllDocsData} from '@docusaurus/plugin-content-docs/client';
|
|
16
16
|
import {
|
|
17
17
|
HtmlClassNameProvider,
|
|
18
|
+
PageMetadata,
|
|
18
19
|
useEvent,
|
|
19
20
|
usePluralForm,
|
|
20
21
|
useSearchQueryString,
|
|
21
22
|
} from '@docusaurus/theme-common';
|
|
22
|
-
import {useTitleFormatter} from '@docusaurus/theme-common/internal';
|
|
23
23
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
24
24
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
25
25
|
import {
|
|
@@ -114,6 +114,24 @@ function SearchVersionSelectList({docsSearchVersionsHelpers}) {
|
|
|
114
114
|
</div>
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
|
+
function getSearchPageTitle(searchQuery) {
|
|
118
|
+
return searchQuery
|
|
119
|
+
? translate(
|
|
120
|
+
{
|
|
121
|
+
id: 'theme.SearchPage.existingResultsTitle',
|
|
122
|
+
message: 'Search results for "{query}"',
|
|
123
|
+
description: 'The search page title for non-empty query',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
query: searchQuery,
|
|
127
|
+
},
|
|
128
|
+
)
|
|
129
|
+
: translate({
|
|
130
|
+
id: 'theme.SearchPage.emptyResultsTitle',
|
|
131
|
+
message: 'Search the documentation',
|
|
132
|
+
description: 'The search page title for empty query',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
117
135
|
function SearchPageContent() {
|
|
118
136
|
const {
|
|
119
137
|
i18n: {currentLocale},
|
|
@@ -125,6 +143,7 @@ function SearchPageContent() {
|
|
|
125
143
|
const documentsFoundPlural = useDocumentsFoundPlural();
|
|
126
144
|
const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
|
|
127
145
|
const [searchQuery, setSearchQuery] = useSearchQueryString();
|
|
146
|
+
const pageTitle = getSearchPageTitle(searchQuery);
|
|
128
147
|
const initialSearchResultState = {
|
|
129
148
|
items: [],
|
|
130
149
|
query: null,
|
|
@@ -231,6 +250,8 @@ function SearchPageContent() {
|
|
|
231
250
|
const observer = useRef(
|
|
232
251
|
ExecutionEnvironment.canUseIntersectionObserver &&
|
|
233
252
|
new IntersectionObserver(
|
|
253
|
+
// TODO need to fix this React Compiler lint error
|
|
254
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
234
255
|
(entries) => {
|
|
235
256
|
const {
|
|
236
257
|
isIntersecting,
|
|
@@ -244,23 +265,6 @@ function SearchPageContent() {
|
|
|
244
265
|
{threshold: 1},
|
|
245
266
|
),
|
|
246
267
|
);
|
|
247
|
-
const getTitle = () =>
|
|
248
|
-
searchQuery
|
|
249
|
-
? translate(
|
|
250
|
-
{
|
|
251
|
-
id: 'theme.SearchPage.existingResultsTitle',
|
|
252
|
-
message: 'Search results for "{query}"',
|
|
253
|
-
description: 'The search page title for non-empty query',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
query: searchQuery,
|
|
257
|
-
},
|
|
258
|
-
)
|
|
259
|
-
: translate({
|
|
260
|
-
id: 'theme.SearchPage.emptyResultsTitle',
|
|
261
|
-
message: 'Search the documentation',
|
|
262
|
-
description: 'The search page title for empty query',
|
|
263
|
-
});
|
|
264
268
|
const makeSearch = useEvent((page = 0) => {
|
|
265
269
|
if (contextualSearch) {
|
|
266
270
|
algoliaHelper.addDisjunctiveFacetRefinement('docusaurus_tag', 'default');
|
|
@@ -304,8 +308,9 @@ function SearchPageContent() {
|
|
|
304
308
|
}, [makeSearch, searchResultState.lastPage]);
|
|
305
309
|
return (
|
|
306
310
|
<Layout>
|
|
311
|
+
<PageMetadata title={pageTitle} />
|
|
312
|
+
|
|
307
313
|
<Head>
|
|
308
|
-
<title>{useTitleFormatter(getTitle())}</title>
|
|
309
314
|
{/*
|
|
310
315
|
We should not index search pages
|
|
311
316
|
See https://github.com/facebook/docusaurus/pull/3233
|
|
@@ -314,7 +319,7 @@ function SearchPageContent() {
|
|
|
314
319
|
</Head>
|
|
315
320
|
|
|
316
321
|
<div className="container margin-vert--lg">
|
|
317
|
-
<Heading as="h1">{
|
|
322
|
+
<Heading as="h1">{pageTitle}</Heading>
|
|
318
323
|
|
|
319
324
|
<form className="row" onSubmit={(e) => e.preventDefault()}>
|
|
320
325
|
<div
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-search-algolia",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0-canary-6327",
|
|
4
4
|
"description": "Algolia search component for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": [
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docsearch/react": "^3.
|
|
37
|
-
"@docusaurus/core": "3.
|
|
38
|
-
"@docusaurus/logger": "3.
|
|
39
|
-
"@docusaurus/plugin-content-docs": "3.
|
|
40
|
-
"@docusaurus/theme-common": "3.
|
|
41
|
-
"@docusaurus/theme-translations": "3.
|
|
42
|
-
"@docusaurus/utils": "3.
|
|
43
|
-
"@docusaurus/utils-validation": "3.
|
|
36
|
+
"@docsearch/react": "^3.9.0",
|
|
37
|
+
"@docusaurus/core": "3.8.0-canary-6327",
|
|
38
|
+
"@docusaurus/logger": "3.8.0-canary-6327",
|
|
39
|
+
"@docusaurus/plugin-content-docs": "3.8.0-canary-6327",
|
|
40
|
+
"@docusaurus/theme-common": "3.8.0-canary-6327",
|
|
41
|
+
"@docusaurus/theme-translations": "3.8.0-canary-6327",
|
|
42
|
+
"@docusaurus/utils": "3.8.0-canary-6327",
|
|
43
|
+
"@docusaurus/utils-validation": "3.8.0-canary-6327",
|
|
44
44
|
"algoliasearch": "^5.17.1",
|
|
45
45
|
"algoliasearch-helper": "^3.22.6",
|
|
46
46
|
"clsx": "^2.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"utility-types": "^3.10.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@docusaurus/module-type-aliases": "3.
|
|
54
|
+
"@docusaurus/module-type-aliases": "3.8.0-canary-6327"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": ">=18.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d50539dea74625c994ac3f78926ed7b37d704c84"
|
|
64
64
|
}
|
|
@@ -269,6 +269,8 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchProps) {
|
|
|
269
269
|
|
|
270
270
|
{isOpen &&
|
|
271
271
|
DocSearchModal &&
|
|
272
|
+
// TODO need to fix this React Compiler lint error
|
|
273
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
272
274
|
searchContainer.current &&
|
|
273
275
|
createPortal(
|
|
274
276
|
<DocSearchModal
|
|
@@ -287,6 +289,8 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchProps) {
|
|
|
287
289
|
translations={props.translations?.modal ?? translations.modal}
|
|
288
290
|
searchParameters={searchParameters}
|
|
289
291
|
/>,
|
|
292
|
+
// TODO need to fix this React Compiler lint error
|
|
293
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
290
294
|
searchContainer.current,
|
|
291
295
|
)}
|
|
292
296
|
</>
|
|
@@ -25,11 +25,11 @@ import Link from '@docusaurus/Link';
|
|
|
25
25
|
import {useAllDocsData} from '@docusaurus/plugin-content-docs/client';
|
|
26
26
|
import {
|
|
27
27
|
HtmlClassNameProvider,
|
|
28
|
+
PageMetadata,
|
|
28
29
|
useEvent,
|
|
29
30
|
usePluralForm,
|
|
30
31
|
useSearchQueryString,
|
|
31
32
|
} from '@docusaurus/theme-common';
|
|
32
|
-
import {useTitleFormatter} from '@docusaurus/theme-common/internal';
|
|
33
33
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
34
34
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
35
35
|
import {
|
|
@@ -160,6 +160,25 @@ type ResultDispatcher =
|
|
|
160
160
|
| {type: 'update'; value: ResultDispatcherState}
|
|
161
161
|
| {type: 'advance'; value?: undefined};
|
|
162
162
|
|
|
163
|
+
function getSearchPageTitle(searchQuery: string | undefined): string {
|
|
164
|
+
return searchQuery
|
|
165
|
+
? translate(
|
|
166
|
+
{
|
|
167
|
+
id: 'theme.SearchPage.existingResultsTitle',
|
|
168
|
+
message: 'Search results for "{query}"',
|
|
169
|
+
description: 'The search page title for non-empty query',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
query: searchQuery,
|
|
173
|
+
},
|
|
174
|
+
)
|
|
175
|
+
: translate({
|
|
176
|
+
id: 'theme.SearchPage.emptyResultsTitle',
|
|
177
|
+
message: 'Search the documentation',
|
|
178
|
+
description: 'The search page title for empty query',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
163
182
|
function SearchPageContent(): ReactNode {
|
|
164
183
|
const {
|
|
165
184
|
i18n: {currentLocale},
|
|
@@ -167,12 +186,13 @@ function SearchPageContent(): ReactNode {
|
|
|
167
186
|
const {
|
|
168
187
|
algolia: {appId, apiKey, indexName, contextualSearch},
|
|
169
188
|
} = useAlgoliaThemeConfig();
|
|
170
|
-
|
|
171
189
|
const processSearchResultUrl = useSearchResultUrlProcessor();
|
|
172
190
|
const documentsFoundPlural = useDocumentsFoundPlural();
|
|
173
191
|
|
|
174
192
|
const docsSearchVersionsHelpers = useDocsSearchVersionsHelpers();
|
|
175
193
|
const [searchQuery, setSearchQuery] = useSearchQueryString();
|
|
194
|
+
const pageTitle = getSearchPageTitle(searchQuery);
|
|
195
|
+
|
|
176
196
|
const initialSearchResultState: ResultDispatcherState = {
|
|
177
197
|
items: [],
|
|
178
198
|
query: null,
|
|
@@ -292,6 +312,8 @@ function SearchPageContent(): ReactNode {
|
|
|
292
312
|
const observer = useRef(
|
|
293
313
|
ExecutionEnvironment.canUseIntersectionObserver &&
|
|
294
314
|
new IntersectionObserver(
|
|
315
|
+
// TODO need to fix this React Compiler lint error
|
|
316
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
295
317
|
(entries) => {
|
|
296
318
|
const {
|
|
297
319
|
isIntersecting,
|
|
@@ -308,24 +330,6 @@ function SearchPageContent(): ReactNode {
|
|
|
308
330
|
),
|
|
309
331
|
);
|
|
310
332
|
|
|
311
|
-
const getTitle = () =>
|
|
312
|
-
searchQuery
|
|
313
|
-
? translate(
|
|
314
|
-
{
|
|
315
|
-
id: 'theme.SearchPage.existingResultsTitle',
|
|
316
|
-
message: 'Search results for "{query}"',
|
|
317
|
-
description: 'The search page title for non-empty query',
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
query: searchQuery,
|
|
321
|
-
},
|
|
322
|
-
)
|
|
323
|
-
: translate({
|
|
324
|
-
id: 'theme.SearchPage.emptyResultsTitle',
|
|
325
|
-
message: 'Search the documentation',
|
|
326
|
-
description: 'The search page title for empty query',
|
|
327
|
-
});
|
|
328
|
-
|
|
329
333
|
const makeSearch = useEvent((page: number = 0) => {
|
|
330
334
|
if (contextualSearch) {
|
|
331
335
|
algoliaHelper.addDisjunctiveFacetRefinement('docusaurus_tag', 'default');
|
|
@@ -378,8 +382,9 @@ function SearchPageContent(): ReactNode {
|
|
|
378
382
|
|
|
379
383
|
return (
|
|
380
384
|
<Layout>
|
|
385
|
+
<PageMetadata title={pageTitle} />
|
|
386
|
+
|
|
381
387
|
<Head>
|
|
382
|
-
<title>{useTitleFormatter(getTitle())}</title>
|
|
383
388
|
{/*
|
|
384
389
|
We should not index search pages
|
|
385
390
|
See https://github.com/facebook/docusaurus/pull/3233
|
|
@@ -388,7 +393,7 @@ function SearchPageContent(): ReactNode {
|
|
|
388
393
|
</Head>
|
|
389
394
|
|
|
390
395
|
<div className="container margin-vert--lg">
|
|
391
|
-
<Heading as="h1">{
|
|
396
|
+
<Heading as="h1">{pageTitle}</Heading>
|
|
392
397
|
|
|
393
398
|
<form className="row" onSubmit={(e) => e.preventDefault()}>
|
|
394
399
|
<div
|