Skip to content

Commit

Permalink
Feat: website updates (#90)
Browse files Browse the repository at this point in the history
* Fix: NavBar not highlighting selected version

* Prefix direct links with latest version

* Feat: Add Docs Redirection

* Feat: redirect

* tidy config

* add badge

* fix

* fix v7 link

---------

Co-authored-by: Baz Utsahajit <[email protected]>
  • Loading branch information
Zyie and bbazukun123 authored Mar 11, 2024
1 parent a8ae86c commit 3b46502
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 59 deletions.
6 changes: 3 additions & 3 deletions blog/2024-03-05-pixi-v8-launches.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ We're incredibly proud of PixiJS v8 and eager to share the improvements and new

## 🔗 Quick links
- The new Docs for v8 can be found [here](https://pixijs.download/v8.0.0/docs/index.html)
- [Migration](/guides/migrations/v8)
- [Examples](/examples)
- [Migration](8.x/guides/migrations/v8)
- [Examples](8.x/examples)
- [Open Games](https://github.com/pixijs/open-games)

---
Expand Down Expand Up @@ -197,7 +197,7 @@ myContainer.blendMode = 'color-burn` // easy!

```
For more information on these graphics upgrades and guidance on how to adapt to the enhanced Graphics API, please refer to the [migration guide](/guides/migrations/v8), or why not jump in and play with some [examples](examples/graphics/simple).
For more information on these graphics upgrades and guidance on how to adapt to the enhanced Graphics API, please refer to the [migration guide](8.x/guides/migrations/v8), or why not jump in and play with some [examples](8.x/examples/graphics/simple).
#### 📝 Text Upgrades
Expand Down
53 changes: 41 additions & 12 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ const config = {
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/pixijs/pixijs.com/tree/main/',
routeBasePath: '/',
lastVersion: 'current',
versions: {
'7.x': {
label: 'v7.x',
path: '7.x',
banner: 'none',
badge: false,
badge: true,
},

current: {
label: 'v8.x (Latest)',
path: '',
label: 'v8.x',
path: '8.x',
banner: 'none',
badge: false,
badge: true,
},
},
},
Expand All @@ -74,7 +75,31 @@ const config = {
],
],

plugins: ['docusaurus-plugin-sass'],
plugins: [
'docusaurus-plugin-sass',
[
'@docusaurus/plugin-client-redirects',
{
// eslint-disable-next-line consistent-return
createRedirects(existingPath)
{
if (existingPath.includes('/7.x')) return undefined;

const pathsToRedirect = ['guides', 'examples', 'tutorials', 'playground'];

for (let i = 0; i < pathsToRedirect.length; i++)
{
const path = pathsToRedirect[i];

if (existingPath.includes(`/${path}`))
{
return [existingPath.replace(`/8.x/${path}`, `/${path}`)];
}
}
},
},
],
],

themes: [
[
Expand Down Expand Up @@ -122,9 +147,19 @@ const config = {
],
},
{
type: 'dropdown',
label: 'API',
position: 'left',
href: `https://pixijs.download/release/docs/index.html`,
items: [
{
label: 'v8.x',
href: 'https://pixijs.download/release/docs/index.html',
},
{
label: 'v7.x',
href: 'https://pixijs.download/v7.x/docs/index.html',
},
],
},
{
type: 'doc',
Expand Down Expand Up @@ -296,12 +331,6 @@ const config = {
disableSwitch: false,
respectPrefersColorScheme: true,
},
// algolia: {
// appId: 'JX6EBQCAGQ',
// apiKey: '2ac1220b913a281bcfeccdf628fa6e99',
// indexName: 'beta_pixijs',
// contextualSearch: false,
// },
}),
};

Expand Down
93 changes: 56 additions & 37 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"prebuild": "npm run update-pixi-version-configs && npm run generate-content",
"prebuild": "npm run generate-content",
"build": "docusaurus build",
"clear": "docusaurus clear",
"predeploy": "npm run generate-content",
Expand Down Expand Up @@ -61,7 +61,7 @@
"@docusaurus/plugin-content-blog": "~2.3.1",
"@docusaurus/plugin-google-analytics": "~2.3.1",
"@docusaurus/preset-classic": "~2.3.1",
"@docusaurus/theme-search-algolia": "~2.3.1",
"@docusaurus/plugin-client-redirects": "~2.3.1",
"@easyops-cn/docusaurus-search-local": "^0.35.0",
"@mdx-js/react": "^1.6.22",
"@monaco-editor/react": "^4.4.6",
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-global-version-configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ recast.visit(ast, {
recast.types.builders.property(
'init',
recast.types.builders.identifier('path'),
recast.types.builders.literal(version.isCurrent ? '' : key),
recast.types.builders.literal(key),
),
recast.types.builders.property(
'init',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Homepage/ClosingSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function ClosingSection(): JSX.Element
anim="short-up-anim"
style={animShortUp(0.3, 0.7)}
label="Get Started"
link="/tutorials"
link="8.x/tutorials"
outline={true}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Homepage/HeroHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function HeroHeader(): JSX.Element
<div className="buttonRow">
<HomeCTA label="Download" link="https://github.com/pixijs/pixijs/releases" />
&nbsp;
<HomeCTA label="Get Started" link="/tutorials" white={true} outline={true} />
<HomeCTA label="Get Started" link="8.x/tutorials" white={true} outline={true} />
</div>
</div>
</header>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/team.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@
"social": {
"github": "https://github.com/baseten"
},
"active": true
"active": false
}
]
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"strict": true,
"target": "ESNext"
},
"exclude": ["build", "node_modules"],
"exclude": ["build", "node_modules", "*.js"],
"ts-node": {
"files": true,
"compilerOptions": {
Expand Down

0 comments on commit 3b46502

Please sign in to comment.