Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: archive v5 docs #3482

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ const fetch = require('node-fetch');

const VERSIONS_JSON = require('./versions.json');

/**
* Old versions of the Ionic Docs are archived so
* that we do not need to re-build it every time we deploy.
* Building a large number of docs sites at once can cause
* out of memory issues, so archiving old docs sites
* allow us to keep memory usage and build times low.
*/
const ARCHIVED_VERSIONS_JSON = require('./versionsArchived.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a note that this JSON file is only for versions that live in the site? Else we might be questioning why v4 and v3 are not included.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Added in 914bc7e


/**
* This returns an array where each entry is an array
* containing the version name at index 0 and
* the archive url at index 1.
*/
const ArchivedVersionsDropdownItems = Object.entries(ARCHIVED_VERSIONS_JSON).splice(0, 5);

const BASE_URL = '/docs';

module.exports = {
Expand Down Expand Up @@ -165,6 +181,20 @@ module.exports = {
type: 'docsVersionDropdown',
position: 'right',
dropdownItemsAfter: [
...ArchivedVersionsDropdownItems.map(([versionName, versionUrl]) => ({
label: versionName,
/**
* Use "to" instead of "href" so the
* external URL icon does not show up.
*/
to: versionUrl,
/**
* Just like the version docs in this project,
* we want to archived versions to open in the
* same tab.
*/
target: '_self',
})),
{ to: 'https://ionicframework.com/docs/v4/components', label: 'v4', target: '_blank' },
{ to: 'https://ionicframework.com/docs/v3/', label: 'v3', target: '_blank' },
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"scripts": {
"prebuild": "npm run generate-markdown; scripts/i18n.sh; if [ -n \"$CROWDIN_PERSONAL_TOKEN\" ]; then npm run crowdin:sync; fi",
"build": "NODE_OPTIONS=--max_old_space_size=8192 npm run build:${VERCEL_ENV:-preview}",
"build": "npm run build:${VERCEL_ENV:-preview}",
"build:preview": "docusaurus build --locale en",
"build:production": "docusaurus build",
"clear": "docusaurus clear",
Expand Down
3 changes: 1 addition & 2 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[
"v7",
"v6",
"v5"
"v6"
]
3 changes: 3 additions & 0 deletions versionsArchived.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"v5": "https://ionic-docs-5utg8ms4c-ionic1.vercel.app/docs/v5/"
}