Skip to content

Commit

Permalink
Added a local search bar
Browse files Browse the repository at this point in the history
  • Loading branch information
YonasW committed Oct 10, 2024
1 parent ec5598c commit 323347a
Show file tree
Hide file tree
Showing 5 changed files with 2,324 additions and 1,404 deletions.
60 changes: 42 additions & 18 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import { themes as prismThemes } from 'prism-react-renderer';

const config: Config = {
title: '0G Documentation',
tagline: 'The Next Generation Web3 Infrastructure',
favicon: 'img/favicon.ico',

url: 'https://docs.0g.ai',
url: 'https://docs.0g.ai',
baseUrl: '/',
organizationName: '0G Labs',
projectName: '0g-docs',
Expand All @@ -20,22 +19,46 @@ const config: Config = {
locales: ['en'],
},

stylesheets: [
{
href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css',
type: 'text/css',
},
],

presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
routeBasePath: '/', // Set docs as the root
routeBasePath: '/',
},
blog: false, // Disable the blog plugin
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],

plugins: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
hashed: true,
language: ["en"],
highlightSearchTermsOnTargetPage: true,
explicitSearchResultPath: true,
searchBarPosition: 'right',
docsRouteBasePath: "/",
searchResultLimits: 8,
searchResultContextMaxLength: 50,
hideSearchBarWithNoSearchContext: false,
},
],
],

themeConfig: {
navbar: {
title: '0G Documentation',
Expand All @@ -44,10 +67,21 @@ const config: Config = {
src: 'img/logo.svg',
},
items: [
{
type: 'search',
position: 'right',
},
{
href: 'https://github.com/0G-Labs/0g-docs',
label: 'GitHub',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
{
href: 'https://twitter.com/0g_labs',
position: 'right',
className: 'header-twitter-link',
'aria-label': 'Twitter profile',
},
],
},
Expand All @@ -57,8 +91,8 @@ const config: Config = {
{
title: 'Docs',
items: [
{ label: 'Introduction', to: '/intro' }, // Updated path
{ label: 'Run a Node', to: '/run-a-node/node-overview' }, // Updated path
{ label: 'Introduction', to: '/intro' },
{ label: 'Run a Node', to: '/run-a-node/node-overview' },
],
},
{
Expand All @@ -72,7 +106,7 @@ const config: Config = {
{
title: 'More',
items: [
{ label: 'Blog', href: 'https://0g.ai/blog' }, // Changed to href
{ label: 'Blog', href: 'https://0g.ai/blog' },
{ label: 'GitHub', href: 'https://github.com/0glabs' },
],
},
Expand All @@ -84,17 +118,7 @@ const config: Config = {
},
copyright: `Copyright © ${new Date().getFullYear()} 0G Labs, Built with Docusaurus.`,
},
prism: {
theme: prismThemes.vsDark,
darkTheme: prismThemes.vsDark,
additionalLanguages: ['bash', 'json', 'yaml'],
},
} satisfies Preset.ThemeConfig,

customFields: {
authUsername: process.env.AUTH_USERNAME,
authPassword: process.env.AUTH_PASSWORD,
},
};

export default config;
Loading

0 comments on commit 323347a

Please sign in to comment.