Merge pull request #244 from creative-commoners/pulls/master/add-cms5

NEW Add CMS 5 sources to user and dev docs (plus some other related changes)
This commit is contained in:
Sabina Talipova 2022-08-11 12:19:09 +12:00 committed by GitHub
commit 95b2ecd799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 707 additions and 475 deletions

View File

@ -20,6 +20,24 @@ Silverstripe CMS 4.x is stored in
The userhelp documentation is stored in the [silverstripe/silverstripe-userhelp-content repo](https://github.com/silverstripe/silverstripe-userhelp-content/).
## What to update when creating a new pre-release major branch, making a stable major release, or making a major EOL
When **creating a new major branch for a pre-release major version**
- Make sure you've added a new major branch to both `silverstripe/developer-docs` and `silverstripe/silverstripe-userhelp-content`
- You probably need to add new major branches for various modules as defined in `sources-user.js` as well
- Add the new major to `sources-docs.js` and `sources-user.js`
- Add the new major to the version select in `src/components/Header.tsx`
- Add the major to the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
For **new stable releases**, you will need to do the following
- Remove the major from the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
- Update the `getDefaultVersion` function's return value to the new stable major in `src/utils/nodes.ts`
- Update redirects in `netlify.toml`
When a **major goes EOL**, add the major to the `EOL` array in the `getVersionMessage` function in `src/utils/nodes.ts`
## Installation
To set up a local instance of [doc.silverstripe.org](https://github.com/silverstripe/doc.silverstripe.org):

View File

@ -14,7 +14,7 @@ class IconExtractor {
const matches = content.match(/icon(Brand)?: ([a-zA-Z0-9_-]+)/);
if (matches) {
const isBrand = typeof matches[1] !== 'undefined';
selectors.push(isBrand ? `fab` : `fas`);
selectors.push(isBrand ? 'fab' : 'fas');
selectors.push(`fa-${matches[2]}`);
}
return selectors;
@ -29,6 +29,12 @@ const whitelist = [
// Syntax highlighting
'pre',
'code',
// Icon classes used in nodes.ts
'far',
'fa-calendar',
'fa-check-circle',
'fa-times-circle',
];
const whitelistPatterns = [

View File

@ -1,20 +1,29 @@
module.exports = [
{
resolve: `gatsby-source-git`,
options: {
name: `docs--4`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `4.11`,
patterns: `en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `docs--3`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `3`,
patterns: `en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `docs--5`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `5`,
patterns: `en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `docs--4`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `4.11`,
patterns: `en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `docs--3`,
remote: `https://github.com/silverstripe/developer-docs.git`,
branch: `3`,
patterns: `en/**`
}
},
];

View File

@ -1,416 +1,484 @@
module.exports = [
/******* main content *********/
// v5
{
resolve: `gatsby-source-git`,
options: {
name: `user--5`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `5`,
patterns: `docs/en/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `6`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/content_review`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/forms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`,
branch: `6`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `3`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `4`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--5--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `4`,
patterns: `docs/en/**`
}
resolve: `gatsby-source-git`,
options: {
name: `user--4`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `4`,
patterns: `docs/en/**`
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `3`,
patterns: `docs/en/**`
}
},
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_review`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `3`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/forms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`,
branch: `5`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `2`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `3`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/versionedfiles`,
remote: `https://github.com/symbiote/silverstripe-versionedfiles`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
// v3
resolve: `gatsby-source-git`,
options: {
name: `user--3`,
remote: `https://github.com/silverstripe/silverstripe-userhelp-content.git`,
branch: `3`,
patterns: `docs/en/**`
}
},
{
// Running a fork. Switch remote back once merged.
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* registry ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `1.0`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* forum ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/forums`,
remote: `https://github.com/silverstripe-archive/silverstripe-forum`,
branch: `0.8`,
patterns: `docs/en/userguide/**`
}
},
/******* contentreview ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_review`,
remote: `https://github.com/silverstripe/silverstripe-contentreview`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* blog ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* userforms ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/forms`,
remote: `https://github.com/silverstripe/silverstripe-userforms`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* translatable ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/working_with_translations`,
remote: `https://github.com/silverstripe/silverstripe-translatable`,
branch: `2.1`,
patterns: `docs/en/userguide/**`
}
},
/******* subsites ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `1.1`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `1.1`,
patterns: `docs/en/userguide/**`
}
},
/******* secureassets ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/securing_files`,
remote: `https://github.com/silverstripe/silverstripe-secureassets`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* taxonomy ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* iframe ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `1.0`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* versionfeed ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* dms ********/
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/document_management_system`,
remote: `https://github.com/silverstripe/silverstripe-dms`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* elemental ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/content_blocks`,
remote: `https://github.com/dnadesign/silverstripe-elemental`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/modules_report`,
remote: `https://github.com/bringyourownideas/silverstripe-maintenance`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
/******* sharedraftcontent ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/share_draft_content`,
remote: `https://github.com/silverstripe/silverstripe-sharedraftcontent`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* documentconverter ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/document_converter`,
remote: `https://github.com/silverstripe/silverstripe-documentconverter`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* ckan-registry ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/ckan_registry`,
remote: `https://github.com/silverstripe/silverstripe-ckan-registry`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******* mfa ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/multi-factor_authentication`,
remote: `https://github.com/silverstripe/silverstripe-mfa`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
/******** securityreport ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
/******** sitewide-content-report ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
// v3
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `2.0`,
patterns: `docs/en/userguide/**`,
}
},
/******* session-manager ********/
// v4
{
resolve: `gatsby-source-git`,
options: {
name: `user--4--optional_features/managing_devices`,
remote: `https://github.com/silverstripe/silverstripe-session-manager`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/versionedfiles`,
remote: `https://github.com/symbiote/silverstripe-versionedfiles`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/setting_up_advancedworkflow`,
remote: `https://github.com/symbiote/silverstripe-advancedworkflow`,
branch: `4`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/online_databases_and_registries`,
remote: `https://github.com/silverstripe/silverstripe-registry`,
branch: `1.0`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/forums`,
remote: `https://github.com/silverstripe-archive/silverstripe-forum`,
branch: `0.8`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/blogs`,
remote: `https://github.com/silverstripe/silverstripe-blog`,
branch: `2`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/working_with_translations`,
remote: `https://github.com/silverstripe/silverstripe-translatable`,
branch: `2.1`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/working_with_multiple_websites`,
remote: `https://github.com/silverstripe/silverstripe-subsites`,
branch: `1.1`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/securing_files`,
remote: `https://github.com/silverstripe/silverstripe-secureassets`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/taxonomies`,
remote: `https://github.com/silverstripe/silverstripe-taxonomy`,
branch: `1`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/iframe`,
remote: `https://github.com/silverstripe/silverstripe-iframe`,
branch: `1.0`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/site_wide_rss_feeds`,
remote: `https://github.com/silverstripe/silverstripe-versionfeed`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--optional_features/document_management_system`,
remote: `https://github.com/silverstripe/silverstripe-dms`,
branch: `master`,
patterns: `docs/en/userguide/**`
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/security_report`,
remote: `https://github.com/silverstripe/silverstripe-securityreport`,
branch: `master`,
patterns: `docs/en/userguide/**`,
}
},
{
resolve: `gatsby-source-git`,
options: {
name: `user--3--managing_your_website/reports/sitewide_content_report`,
remote: `https://github.com/silverstripe/silverstripe-sitewidecontent-report`,
branch: `2.0`,
patterns: `docs/en/userguide/**`,
}
},
];

View File

@ -61,7 +61,8 @@ const Header: StatelessComponent<HeaderProps> = ({ handleSidebarToggle }): React
</div>
<ul className="social-list list-inline d-flex flex-grow-1 flex-lg-grow-0 align-items-center justify-content-lg-center justify-content-end justify-content-lg-end">
<li className="list-inline-item version-select">
<select id="version-select" value={getCurrentVersion() || '4'} onChange={handleNavigate}>
<select id="version-select" value={getCurrentVersion()} onChange={handleNavigate}>
<option value='5'>V5</option>
<option value='4'>V4</option>
<option value='3'>V3</option>
</select>

View File

@ -11,22 +11,23 @@ interface LayoutProps {
}
}
const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug } }) => {
const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode } = useHierarchy();
const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode, getDefaultVersion, getVersionMessage } = useHierarchy();
const [isToggled, setSidebarOpen] = useState(false);
const handleNavigate = () => setSidebarOpen(false);
setCurrentPath(slug);
const ver = getCurrentVersion();
const currentNode = getCurrentNode();
const versionMessage = getVersionMessage();
return (
<>
{currentNode && ver !== '4' && (
{currentNode && ver !== getDefaultVersion() && (
<Helmet
link={[
{
rel: 'canonical',
href: getVersionPath(currentNode, '4'),
href: getVersionPath(currentNode, getDefaultVersion()),
}
]}
/>
@ -37,7 +38,10 @@ const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug
<div className="docs-content">
<div className="container">
<article role="main" className="docs-article">
<>
{versionMessage}
{children}
</>
</article>
</div>
</div>

View File

@ -14,6 +14,8 @@ import {
initialise,
getVersionPath,
setCurrentPath,
getDefaultVersion,
getVersionMessage,
} from '../utils/nodes';
const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug } }): ReactElement => {
@ -59,6 +61,8 @@ const NodeProvider: StatelessComponent<{}> = ({ children, pageContext: { slug }
getSiblings,
getVersionPath,
setCurrentPath,
getDefaultVersion,
getVersionMessage,
}}>
{children}
</NodeContext.Provider>

View File

@ -1,4 +1,4 @@
import { useContext } from 'react';
import { useContext, ReactElement } from 'react';
import NodeContext from '../contexts/NodeContext';
import { SilverstripeDocument } from '../types';
@ -12,8 +12,10 @@ interface NodeFunctions {
getHomePage(): SilverstripeDocument|null;
getNavChildren(node: SilverstripeDocument): SilverstripeDocument[];
getCurrentVersion(): string;
getVersionPath(currentNode: SilverstripeDocument, version: number): string;
getVersionPath(currentNode: SilverstripeDocument, version: number|string): string;
setCurrentPath(slug: string): undefined;
getDefaultVersion(): string;
getVersionMessage(): ReactElement | ReactElement[] | string | null;
};
const useHierarchy = (): NodeFunctions => {

View File

@ -14,9 +14,10 @@
.nav-link {
display: block;
padding: $nav-link-padding-y $nav-link-padding-x;
text-decoration: none;
@include hover-focus {
text-decoration: none;
text-decoration: underline;
}
// Disabled state lightens text

View File

@ -29,9 +29,13 @@ $wordpress-color: #028cb0;
$single-col-max: 800px;
$theme-success-color: #5cb377;
$theme-success-color-dark: #39794D;
$theme-warning-color: #EEBF41;
$theme-warning-color-dark: #9E6100;
$theme-info-color: #5b99ea;
$theme-info-color-dark: #1c6fdc;
$theme-danger-color: #d26d69;
$theme-danger-color-dark: #b73c37;

View File

@ -13,6 +13,10 @@ h1, h2, h3, h4, h5, h6 {
font-family: 'Poppins', sans-serif;
color: $theme-text-color-primary;
font-weight: 600;
code[class*="language-"] {
font-size: 0.8em;
}
}
code {
@ -59,16 +63,27 @@ code {
border-bottom-color: darken($theme-bg-light, 5%);
}
a.theme-link {
color: $theme-text-color-primary;
a {
text-decoration: underline;
-webkit-text-decoration-color: rgba($theme-text-color-primary,0.3);
text-decoration-color: rgba($theme-text-color-primary,0.3);
&:hover {
color: $theme-color-primary;
-webkit-text-decoration-color: rgba($theme-color-primary,0.8);
text-decoration-color: rgba($theme-color-primary,0.8);
}
&:hover {
text-decoration: none;
}
&.theme-link {
color: $theme-text-color-primary;
-webkit-text-decoration-color: rgba($theme-text-color-primary,0.3);
text-decoration-color: rgba($theme-text-color-primary,0.3);
&:hover {
color: $theme-color-primary;
-webkit-text-decoration-color: rgba($theme-color-primary,0.8);
text-decoration-color: rgba($theme-color-primary,0.8);
}
}
&.btn {
text-decoration: none;
}
}
.btn {

View File

@ -172,11 +172,6 @@
.section-title {
font-size: 1rem;
margin-bottom: 1rem;
a {
&:hover {
text-decoration: none;
}
}
}
.section-items {
font-size: 0.875rem;
@ -207,7 +202,6 @@
color: $theme-color-primary;
&:before {
background-color: $theme-color-primary;
}
.theme-icon-holder {
color: #fff;
@ -267,7 +261,6 @@
margin-bottom: 0;
}
}
}
.anchor {
@ -275,18 +268,6 @@
margin-left: 1rem;
opacity: 0;
transition: opacity .2s;
/* Force anchor link to offset header */
margin-top: -90px;
padding-top: 90px;
&:focus {
opacity: 1;
/* Outline behaves incorrectly due to offset, use underline instead */
outline: none;
text-decoration: underline;
}
}
:hover > .anchor {
opacity: 1;
@ -346,40 +327,94 @@
border-color: $theme-info-color;
background: lighten($theme-info-color, 35%);
.callout-title {
color: darken($theme-info-color, 15%);
color: $theme-info-color-dark;
}
a {
color: darken($theme-info-color, 15%);
color: $theme-info-color-dark;
}
}
&.callout-block-success {
border-color: $theme-success-color;
background: lighten($theme-success-color, 40%);
.callout-title {
color: darken($theme-success-color, 15%);
color: $theme-success-color-dark;
}
a {
color: darken($theme-success-color, 15%);
color: $theme-success-color-dark;
}
}
&.callout-block-warning {
border-color: $theme-warning-color;
background: lighten($theme-warning-color, 35%);
.callout-title {
color: darken($theme-warning-color, 15%);
color: $theme-warning-color-dark;
}
a {
color: darken($theme-warning-color, 15%);
color: $theme-warning-color-dark;
}
}
&.callout-block-danger {
border-color: $theme-danger-color;
background: lighten($theme-danger-color, 35%);
.callout-title {
color: darken($theme-danger-color, 15%);
color: $theme-danger-color-dark;
}
a {
color: darken($theme-danger-color, 15%);
color: $theme-danger-color-dark;
}
}
}
.callout-block--version {
border-left-width: 6px;
padding-top: 1rem;
padding-bottom: 1rem;
.callout-version-title {
display: flex;
font-size: 1rem;
font-weight: $font-weight-bold;
color: lighten($theme-text-color-primary, 15%);
.callout-version-stability {
display: flex;
align-items: center;
margin-left: auto;
font-size: 1.125rem;
}
.callout-version-stability-text {
text-transform: uppercase;
font-size: 0.875rem;
margin-left: 10px;
}
}
.callout-version-content {
padding-top: 10px;
}
&.callout-block-success {
.callout-version-stability {
color: $theme-success-color-dark;
}
}
&.callout-block-info {
.callout-version-stability {
color: $theme-info-color-dark;
}
}
&.callout-block-warning {
.callout-version-stability {
color: $theme-warning-color-dark;
}
}
&.callout-block-danger {
.callout-version-stability {
color: $theme-danger-color-dark;
}
}
}

View File

@ -1,6 +1,7 @@
import parse from 'html-react-parser';
import { ReactElement } from 'react';
import { SilverstripeDocument } from '../types';
import sortFiles from './sortFiles';
import { node } from 'prop-types';
let __nodes: SilverstripeDocument[];
let __currentVersion: string | null = null;
@ -139,10 +140,59 @@ const getHomePage = (): SilverstripeDocument | null => {
return homeMap.get(slug);
};
/**
* Get the default version
*/
const getDefaultVersion = (): string => '4';
/**
* Get the selected version
*/
const getCurrentVersion = (): string => __currentVersion || '4';
const getCurrentVersion = (): string => __currentVersion || getDefaultVersion();
/**
* Get a message to display for all pages on this version's docs
*/
const getVersionMessage = (): ReactElement | ReactElement[] | string | null => {
const EOL = [
'3',
];
const PRE_RELEASE = [
'5',
];
const version = getCurrentVersion();
const stablePath = getVersionPath(getCurrentNode(), getDefaultVersion());
// Output the appropriate message and styling
function makeMessage(style: string, icon: string, stability: string, message: string|null): string {
let template = `<div id="version-callout" class="callout-block callout-block--version callout-block-${style}">
<div class="callout-version-title">Version ${version}<span class="callout-version-stability">
<i class="far fa-${icon}"></i><span class="callout-version-stability-text">${stability}</span></span>
</div>`;
if (message) {
template += `<div class="callout-version-content">
This version of Silverstripe CMS ${message}.
<a href="${stablePath}">Go to documentation for the most recent stable version.</a>
</div>`;
}
template += '</div>';
return template;
}
// Return the correct message for the current version
if (EOL.includes(version)) {
return parse(makeMessage('danger', 'times-circle', 'end of life', 'will not recieve any additional bug fixes or documentation updates'));
}
if (PRE_RELEASE.includes(version)) {
return parse(makeMessage(
'warning',
'calendar',
'pre-stable',
'has not yet been given a stable release. See <a target="_blank" href="https://www.silverstripe.org/software/roadmap/">the release roadmap</a> for more information'
));
}
return parse(makeMessage('success', 'check-circle', 'supported', null));
};
/**
@ -150,11 +200,15 @@ const getCurrentVersion = (): string => __currentVersion || '4';
* @param currentNode
* @param version
*/
const getVersionPath = (currentNode: SilverstripeDocument, version: number): string => {
const newPath = currentNode.slug.replace(/^\/en\/[0-9]+\//, `/en/${version}/`);
const getVersionPath = (currentNode: SilverstripeDocument|null, version: number|string): string => {
const basePath = `/en/${version}`;
if (!currentNode) {
return basePath;
}
const newPath = currentNode.slug.replace(/^\/en\/[0-9]+\//, `${basePath}/`);
const otherNode = getNodes().find(n => n.slug === newPath);
return otherNode ? otherNode.slug : `/en/${version}`;
return otherNode ? otherNode.slug : basePath;
};
/**
@ -178,5 +232,7 @@ export {
getNavChildren,
getCurrentVersion,
getVersionPath,
setCurrentPath
setCurrentPath,
getDefaultVersion,
getVersionMessage,
};

View File

@ -1,9 +1,11 @@
import { getCurrentVersion } from './nodes';
/**
* If an href is preceded with api:, rewrite it to the api.silverstripe.org site
* @param link
*/
const rewriteAPILink = (link: string): string => {
const version = 4;
const version = getCurrentVersion();
const match = link.match(/api\:(.*)/);
if (!match) {
console.error(`Unable to resolve api link ${link}!`);

View File

@ -65,6 +65,13 @@ const rewriteHeaders = (domNode: DomElement): ReactElement | false => {
domNode.children?.push(anchor);
if (domNode.name === 'h1') {
if (!domNode.attribs) {
domNode.attribs = {};
}
domNode.attribs['aria-details'] = 'version-callout';
}
return domToReact([domNode]);
}