How it works:
Standalone Page Limitations:
Overview:
Standalone Integration can be used to add editable CMS content areas to existing individual pages in an application. This can be used together with, or apart from, a site with a Router Integration.
Integration:
npm install jsharmony-cms-sdk-next
import type { GetServerSideProps } from 'next';
import { JshCms, JshCmsRouter, JshCmsPage, JshCmsContentArea } from 'jsharmony-cms-sdk-next'
const jshCmsConfig = new {
redirectListingPath: "jshcms_redirects.json",
cmsServerUrls: ["https://cms.example.com/"],
contentUrl: "https://domain.com/path/to/content/"
};
const jshCmsRouter = new JshCmsRouter(jshCmsConfig);
export const getServerSideProps: GetServerSideProps = async(context) => {
const jshCmsPage = await jshCmsRouter.getStandalonePage(context.resolvedUrl, context.query); // or ('/cms_page_path', context.query)
return { props: { jshCmsPage } };
};
export default function Page({ jshCmsPage }: { jshCmsPage: JshCmsPage }) {
return (
<JshCms jshCmsPage={jshCmsPage} jshCmsConfig={jshCmsConfig}>
<h1 cms-title="true">{jshCmsPage?.title||'Title'}</h1>
<JshCmsContentArea cms-content="body">Page Content</JshCmsContentArea>
</JshCms>
);
};
export default function Page({ jshCmsPage }: { jshCmsPage: JshCmsPage }) {
return (
<JshCms jshCmsPage={jshCmsPage} jshCmsConfig={jshCmsConfig}>
<JshCmsPageConfig config={{
content: {
col1: { title: "Column 1" },
col2: { title: "Column 2" }
}
}} />
<h1 cms-title="true">{jshCmsPage?.title||'Title'}</h1>
<JshCmsContentArea cms-content="col1">Column 1</JshCmsContentArea>
<JshCmsContentArea cms-content="col2">Column 2</JshCmsContentArea>
</JshCms>
);
};