-
Notifications
You must be signed in to change notification settings - Fork 434
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (54 loc) · 2.08 KB
/
index.js
File metadata and controls
54 lines (54 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"use strict";
/**
* Copyright (c) Facebook, Inc. And its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateThemeConfig = void 0;
exports.default = themeSearchAlgolia;
const theme_translations_1 = require("@docusaurus/theme-translations");
const opensearch_1 = require("./opensearch");
const utils_1 = require("./utils");
function themeSearchAlgolia(context) {
const { baseUrl, siteConfig: { themeConfig }, i18n: { currentLocale }, } = context;
const { algolia: { searchPagePath }, } = themeConfig;
return {
name: 'docsearch-docusaurus-algolia-search',
getThemePath() {
return '../lib/theme';
},
getTypeScriptThemePath() {
return '../src/theme';
},
getDefaultCodeTranslationMessages() {
return (0, theme_translations_1.readDefaultCodeTranslationMessages)({
locale: currentLocale,
name: 'theme-search-algolia',
});
},
contentLoaded({ actions: { addRoute } }) {
if (searchPagePath) {
addRoute({
path: (0, utils_1.normalizeUrl)([baseUrl, searchPagePath]),
component: '@theme/SearchPage',
exact: true,
});
}
},
async postBuild() {
if ((0, opensearch_1.shouldCreateOpenSearchFile)({ context })) {
await (0, opensearch_1.createOpenSearchFile)({ context });
}
},
injectHtmlTags() {
if ((0, opensearch_1.shouldCreateOpenSearchFile)({ context })) {
return { headTags: (0, opensearch_1.createOpenSearchHeadTags)({ context }) };
}
return {};
},
};
}
var validateThemeConfig_1 = require("./validateThemeConfig");
Object.defineProperty(exports, "validateThemeConfig", { enumerable: true, get: function () { return validateThemeConfig_1.validateThemeConfig; } });