Docusaurus
npx create-docusaurus@latest my-website classic
cd my-website
npm start
# npx docusaurus start
# http://localhost:3000
# Search
npm install --save @easyops-cn/docusaurus-search-local
# config - https://github.com/easyops-cn/docusaurus-search-local
# https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-pwa
npm install --save @docusaurus/plugin-pwa
npm install --save @docusaurus/plugin-google-gtag
npm install --save @docusaurus/plugin-ideal-image
# Build and serve
npm run build
npm run serve
# Publishes the website to GitHub pages
npm deploy
Docusaurus authentication with Firebase | by Thomasdevshare | Medium
Extensions
swizzling - allows deeper site customizations
swizzling permits to swap a theme component with your own implementation, and it comes in 2 patterns
- Ejecting: creates a copy of the original theme component, which you can fully customize
- Wrapping: creates a wrapper around the original theme component, which you can enhance
Plugins
📦 plugin-client-redirects | Docusaurus
📦 plugin-ideal-image | Docusaurus
📦 plugin-google-gtag | Docusaurus
📦 plugin-content-docs | Docusaurus
Upgrading from v2 to v3
Announcing Docusaurus 3.0 | Docusaurus
Upgrading to Docusaurus v3 | Docusaurus
# check if all files compile successfully
npx docusaurus-mdx-checker
Search
Local Search
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
({
hashed: true,
docsRouteBasePath: '/',
highlightSearchTermsOnTargetPage: true,
}),
],
],
Algolia
Run your own | DocSearch by Algolia
algolia: {
// The application ID provided by Algolia
appId: 'X3OY8NGHVH',
// Public API key: it is safe to commit it
apiKey: '55231a2d373a93253025c5b165065e15',
indexName: 'deepaksood619io',
// Optional: see doc section below
contextualSearch: true,
// Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them.
externalUrlRegex: 'external\\.com|domain\\.com',
// Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs
replaceSearchResultPathname: {
from: '/docs/', // or as RegExp: /\/docs\//
to: '/',
},
// Optional: Algolia search parameters
searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: 'search',
//... other Algolia params
},