NEW Add CMS 5 sources to user and dev docs.

This commit is contained in:
Guy Sartorelli 2022-07-22 12:16:07 +12:00
parent f7cf11e6b9
commit a0de65a48a
7 changed files with 217 additions and 25 deletions

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,4 +1,177 @@
module.exports = [
// 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`,

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,7 +11,7 @@ interface LayoutProps {
}
}
const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug } }) => {
const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode } = useHierarchy();
const { setCurrentPath, getVersionPath, getCurrentVersion, getCurrentNode, getDefaultVersion } = useHierarchy();
const [isToggled, setSidebarOpen] = useState(false);
const handleNavigate = () => setSidebarOpen(false);
@ -21,12 +21,12 @@ const Layout: StatelessComponent<LayoutProps> = ({ children, pageContext: { slug
return (
<>
{currentNode && ver !== '4' && (
{currentNode && ver !== getDefaultVersion() && (
<Helmet
link={[
{
rel: 'canonical',
href: getVersionPath(currentNode, '4'),
href: getVersionPath(currentNode, getDefaultVersion()),
}
]}
/>

View File

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

View File

@ -12,8 +12,9 @@ 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;
};
const useHierarchy = (): NodeFunctions => {

View File

@ -139,10 +139,15 @@ 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();
/**
@ -178,5 +183,6 @@ export {
getNavChildren,
getCurrentVersion,
getVersionPath,
setCurrentPath
setCurrentPath,
getDefaultVersion,
};