Skip to content

Commit

Permalink
fix: Add redirect for moved documentation pages. (#106)
Browse files Browse the repository at this point in the history
* chore: add client redirects plugin

* fix: add redirects

* ci: clear out old docs artifacts.

* docs: add docs line about how to implement redirects.
  • Loading branch information
SandPod authored May 17, 2024
1 parent 00ceab7 commit 2ed6722
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --global user.name "serverpod_docs"
rm -rf target/docs/*
cp -r src/build/* target/docs
cd target
git add .
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ If you need to make changes to the latest version, you can do so by removing the
npm run docusaurus docs:version X.X.X
```

### Add redirects
To maintain link integrity when relocating or renaming documentation pages, it's recommended to implement redirects. This is facilitated by the `@docusaurus/plugin-client-redirects` plugin. Redirects can be configured in the `docusaurus.config.js` file, within the `redirects` section of the plugin configuration.

### Deploy

Once a PR is merged into the `main` branch of this repository, a GitHub action is triggered that builds the documentation and pushes the build to the `docs` directory within the `serverpod.github.io` repository. The built documentation is committed as a new commit to the `main` branch and is then deployed to Github pages by the `serverpod.github.io` repository.
Expand Down
24 changes: 24 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ const config = {
"data-project-logo": "https://avatars.githubusercontent.com/u/48181558?s=200&v=4",
async: true,
}],
plugins: [
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
// Moved in version 1.1.1
from: ['/concepts/authentication'],
to: '/concepts/authentication/setup',
},
{
// Moved in version 1.1.1
from: ['/tutorials'],
to: '/tutorials/first-app',
},
{
// Moved in version 1.2.0
from: ['/concepts/database-communication'],
to: '/concepts/database/connection',
}
]
}
]
]
};

module.exports = config;
88 changes: 56 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@docusaurus/core": "3.0.0",
"@docusaurus/plugin-client-redirects": "3.0.0",
"@docusaurus/preset-classic": "3.0.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.1.1",
Expand Down

0 comments on commit 2ed6722

Please sign in to comment.