Skip to content

Commit

Permalink
[feat] Using Algolia DocSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
song7788q committed Aug 20, 2024
1 parent 4aa1fb6 commit 89a33db
Show file tree
Hide file tree
Showing 14 changed files with 610 additions and 915 deletions.
6 changes: 3 additions & 3 deletions config/ssrTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ module.exports = {
<%~ metaAttribute %>
<% }); %>
<% it.stylesheets.forEach((stylesheet) => { %>
<link rel="stylesheet" href="<%= 'https://cdnd.selectdb.com' %><%= it.baseUrl %><%= stylesheet %>" />
<link rel="stylesheet" href="<%= it.baseUrl %><%= stylesheet %>" />
<% }); %>
<% it.scripts.forEach((script) => { %>
<link rel="preload" href="<%= 'https://cdnd.selectdb.com' %><%= it.baseUrl %><%= script %>" as="script">
<link rel="preload" href="<%= it.baseUrl %><%= script %>" as="script">
<% }); %>
</head>
<body <%~ it.bodyAttributes %>>
Expand All @@ -25,7 +25,7 @@ module.exports = {
<%~ it.appHtml %>
</div>
<% it.scripts.forEach((script) => { %>
<script src="<%= 'https://cdnd.selectdb.com' %><%= it.baseUrl %><%= script %>"></script>
<script src="<%= it.baseUrl %><%= script %>"></script>
<% }); %>
<%~ it.postBodyTags %>
</body>
Expand Down
53 changes: 33 additions & 20 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const config = {
sidebarPath: require.resolve('./sidebarsCommunity.json'),
}),
],
process.env.NODE_ENV === 'development' ? null : customDocusaurusPlugin,
// process.env.NODE_ENV === 'development' ? null : customDocusaurusPlugin,
[
'@docusaurus/plugin-pwa',
{
Expand Down Expand Up @@ -202,26 +202,37 @@ const config = {
}),
],
],
themes: [
[
'@easyops-cn/docusaurus-search-local',
{
hashed: true,
language: ['en', 'zh'],
highlightSearchTermsOnTargetPage: true,
// indexPages: true,
indexDocs: true,
docsRouteBasePath: '/',
indexBlog: false,
explicitSearchResultPath: true,
searchBarShortcut: true,
searchBarShortcutHint: true,
},
],
],
// themes: [
// [
// '@easyops-cn/docusaurus-search-local',
// {
// hashed: true,
// language: ['en', 'zh'],
// highlightSearchTermsOnTargetPage: true,
// // indexPages: true,
// indexDocs: true,
// docsRouteBasePath: '/',
// indexBlog: false,
// explicitSearchResultPath: true,
// searchBarShortcut: true,
// searchBarShortcutHint: true,
// },
// ],
// ],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
algolia: {
appId: 'UUKF60R98F',
apiKey: '1b34939eb7c1508a11571110b04cbc2e',
indexName: 'apache-doris',
contextualSearch: true,
searchParameters: {
facetFilters: ['docusaurus_tag', 'language', 'lang', 'version', 'type'],
},
maxResultsPerGroup: 7,
debug: true,
},
matomo: {
matomoUrl: 'https://analytics.apache.org/',
siteId: '43',
Expand Down Expand Up @@ -316,7 +327,8 @@ const config = {
// to: '/docs/install/source-install/compilation-with-docker',
type: 'doc',
docId: 'install/source-install/compilation-with-docker',
activeBaseRegex: 'summary|install/cluster-deployment|install/source-install|db-connect|table-design|data-operate|query|lakehouse|compute-storage-decoupled|admin-manual|practical-guide|sql-manual',
activeBaseRegex:
'summary|install/cluster-deployment|install/source-install|db-connect|table-design|data-operate|query|lakehouse|compute-storage-decoupled|admin-manual|practical-guide|sql-manual',
},
{
label: '性能测试',
Expand Down Expand Up @@ -379,7 +391,8 @@ const config = {
// to: '/docs/install/source-install/compilation-with-docker',
type: 'doc',
docId: 'install/source-install/compilation-with-docker',
activeBaseRegex: 'summary|install/cluster-deployment|install/source-install|db-connect|table-design|data-operate|query|lakehouse|compute-storage-decoupled|admin-manual|practical-guide|sql-manual'
activeBaseRegex:
'summary|install/cluster-deployment|install/source-install|db-connect|table-design|data-operate|query|lakehouse|compute-storage-decoupled|admin-manual|practical-guide|sql-manual',
},
{
label: 'Benchmark',
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "doris-website",
"version": "2.0.0",
"version": "3.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"start:zh-CN": "docusaurus start --locale zh-CN",
"build": "NODE_OPTIONS=--max_old_space_size=8192 PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js docusaurus build",
"build": "NODE_OPTIONS=--max_old_space_size=12288 PWA_SERVICE_WORKER_URL=https://doris.apache.org/sw.js docusaurus build",
"build:version": "docusaurus set-versions && docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
Expand All @@ -23,7 +23,6 @@
"@docusaurus/plugin-client-redirects": "^2.4.1",
"@docusaurus/plugin-pwa": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.1",
"@easyops-cn/docusaurus-search-local": "^0.30.2",
"@mdx-js/react": "^1.6.22",
"antd": "^5.12.2",
"autoprefixer": "^10.4.16",
Expand Down
64 changes: 58 additions & 6 deletions src/scss/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@
@import './components/search';
@import './common';


@layer utilities {
.transition-slide {
@apply inline-block transform transition-transform duration-300 hover:translate-x-1 group-hover:translate-x-1;
}
}


.button-primary {
display: flex;
height: 52px;
Expand All @@ -34,16 +32,16 @@
align-items: center;
gap: 4px;
border-radius: 4px;
background: var(--b-1, #444FD9);
background: var(--b-1, #444fd9);
color: white;
}

:root {
--font-family-base: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-family-base: 'SF Pro Display', 'SF Pro Icons', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.markdown :where(p, h1, h2, h3, h4, h5, h6, li, blockquote) {
font-family: var(--font-family-base);
color: #2a2f34
color: #2a2f34;
}
// body, .markdown {
// font-family: var(--font-family-base);
Expand All @@ -53,4 +51,58 @@
.navbar__link {
font-family: var(--font-family-base);
font-weight: 400 !important;
}
}

.DocSearch {
/* --docsearch-primary-color: var(--ifm-color-primary); */
/* --docsearch-text-color: var(--ifm-font-color-base); */
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
--docsearch-container-background: rgba(94, 100, 112, 0.7);
/* 弹窗 */
--docsearch-modal-background: var(--ifm-color-secondary-lighter);
/* 搜索框 */
--docsearch-searchbox-background: var(--ifm-color-secondary);
--docsearch-searchbox-focus-background: var(--ifm-color-white);
/* 条目 */
--docsearch-hit-color: var(--ifm-font-color-base);
--docsearch-hit-active-color: var(--ifm-color-white);
--docsearch-hit-background: var(--ifm-color-white);
/* 页脚 */
--docsearch-footer-background: var(--ifm-color-white);
&.DocSearch-Button {
border-radius: 8px;
background-color: #f7f9fe;
height: 40px;
padding: 0 16px;
width: 247px;
color: #4c576c;
font-size: 14px;
font-weight: normal;
&:hover {
box-shadow: none;
background: #f7f9fe;
}
.DocSearch-Button-Placeholder {
color: #8592a6;
font-size: 12px;
font-weight: normal;
}
.DocSearch-Button-Keys {
min-width: auto;
background-color: #fff;
border-radius: 2px;
.DocSearch-Button-Key {
margin-right: 0;
box-shadow: none;
background: transparent;
border-radius: 0;
top: 1px;
width: 14px;
}
}
.DocSearch-Search-Icon {
width: 14px;
stroke-width: 1.5;
}
}
}
12 changes: 0 additions & 12 deletions src/theme/SearchBar/EmptyTemplate.js

This file was deleted.

Loading

0 comments on commit 89a33db

Please sign in to comment.