Static CMS exposes a window.CMS global object that you can use to register external links or links custom pages, via registerAdditionalLink. The links are displayed at the bottom of the navigation menu in the order they are registered.
React Components Inline
The registerAdditionalLink requires you to provide a React component. If you have a build process in place for your project, it is possible to integrate with this build process.
However, although possible, it may be cumbersome or even impractical to add a React build phase. For this reason, Static CMS exposes some constructs globally to allow you to create components inline: h (alias for React.createElement) as well some basic hooks (useState, useMemo, useEffect, useCallback).
Params
registerAdditionalLink takes an AdditionalLink object with the following properties:
|
Param 17462_dbe1b8-73> |
Type 17462_98c30d-18> |
Description 17462_5a4937-2b> |
|---|---|---|
|
id 17462_3b71e2-4e> |
string 17462_276468-7e> |
Unique identifier for the link 17462_d657e8-35> |
|
title 17462_7427cc-da> |
string 17462_753055-17> |
Display text for the link 17462_c8c8ce-57> |
|
data 17462_cc0e37-eb> |
string |
|
|
options 17462_8c1155-31> |
object 17462_aa805d-51> |
Optional. See Options 17462_37bf86-db> |
Options
Available options for each additional link are:
|
Param 17462_8a8d74-5a> |
Type 17462_5ced4d-d3> |
Description 17462_5987be-1d> |
|---|---|---|
|
iconName 17462_abfe63-12> |
string 17462_3b1661-bc> |
The name of a custom registered icon to display. See Custom Icons 17462_fa87e4-29> |
Examples
External Links
CMS.registerAdditionalLink({
id: 'example',
title: 'Example.com',
data: 'https://web.archive.org/web/20240224001641/https://example.com',
options: {
icon: 'page',
},
});const CustomPage = () => {
return h('div', {}, 'I am a custom page!');
};
CMS.registerAdditionalLink({
id: 'custom-page',
title: 'Custom Page',
data: CustomPage,
options: {
icon: 'page',
},
});const CustomPage = () => {
return <div>I am a custom page!</div>;
};
CMS.registerAdditionalLink({
id: 'custom-page',
title: 'Custom Page',
data: CustomPage,
options: {
icon: 'page',
},
});import type { FC } from 'react';
const CustomPage: FC = () => {
return <div>I am a custom page!</div>;
};
CMS.registerAdditionalLink({
id: 'custom-page',
title: 'Custom Page',
data: CustomPage,
options: {
icon: 'page',
},
});