Skip to content

Commit

Permalink
Remove /docs from the search result pathname when we're in a preview …
Browse files Browse the repository at this point in the history
…deployment (#46)
  • Loading branch information
mellson committed Jan 30, 2023
1 parent 016a485 commit f6b84b3
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 369 deletions.
14 changes: 12 additions & 2 deletions docusaurus.config.js
Expand Up @@ -30,8 +30,10 @@ const config = {

scripts: [
{
src: 'https://plausible.io/js/script.js', defer: true, 'data-domain': 'stately.ai/docs'
}
src: 'https://plausible.io/js/script.js',
defer: true,
'data-domain': 'stately.ai/docs',
},
],

presets: [
Expand Down Expand Up @@ -152,6 +154,14 @@ const config = {
apiKey: process.env.ALGOLIA_API_KEY,
indexName: process.env.ALGOLIA_INDEX,
contextualSearch: false,
replaceSearchResultPathname:
// Remove /docs from the search result pathname when we're in a preview deployment
process.env.VERCEL_ENV === 'preview'
? {
from: '/docs/',
to: '/',
}
: undefined,
},
announcementBar: {
content:
Expand Down
11 changes: 4 additions & 7 deletions package.json
Expand Up @@ -12,27 +12,24 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"postinstall": "patch-package"
"typecheck": "tsc"
},
"dependencies": {
"@docusaurus/core": "2.2.0",
"@docusaurus/preset-classic": "2.2.0",
"@docusaurus/core": "2.3.0",
"@docusaurus/preset-classic": "2.3.0",
"@mdx-js/react": "^1.6.22",
"@xstate/inspect": "^0.7.0",
"@xstate/machine-extractor": "^0.7.1",
"@xstate/react": "^3.0.1",
"clsx": "^1.2.1",
"docusaurus-preset-shiki-twoslash": "^1.1.38",
"patch-package": "^6.5.0",
"postinstall-postinstall": "^2.1.0",
"prism-react-renderer": "^1.3.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"xstate": "^4.34.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.2.0",
"@docusaurus/module-type-aliases": "2.3.0",
"@tsconfig/docusaurus": "^1.0.6",
"dotenv": "^16.0.3",
"typescript": "^4.8.4"
Expand Down
46 changes: 0 additions & 46 deletions patches/@docusaurus+theme-search-algolia+2.2.0.patch

This file was deleted.

1 comment on commit f6b84b3

@vercel
Copy link

@vercel vercel bot commented on f6b84b3 Jan 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./

stately-docs.vercel.app
docs-statelyai.vercel.app
docs-git-main-statelyai.vercel.app

Please sign in to comment.