- {header.notification_bar.show_announcement ? (
- parse(header.notification_bar.announcement_text)
- ) : (
+ {header.notification_bar.show_announcement ? typeof header.notification_bar.announcement_text === "string"
+ && (
+ parse(header.notification_bar.announcement_text)
+ ) : (
Devtools section
)}
}
{bucket.title_h3 ?
{bucket.title_h3}
: ""}
- {bucket.description && parse(bucket.description)}
+ {typeof bucket.description === "string" && parse(bucket.description)}
{bucket.call_to_action.title ? (
{embedCode.title &&
{embedCode.title}
}
- {embedCode.description && parse(embedCode.description)}
+ {typeof embedCode.description === "string" && parse(embedCode.description)}
- {embedCode.html_code
+ {typeof embedCode.html_code === "string"
&& parse(embedCode.html_code)}
@@ -19,7 +19,7 @@ export default function SectionWithHtmlCode(props) {
return (
- {parse(embedCode.html_code)}
+ {typeof embedCode.html_code === "string" && parse(embedCode.html_code)}
{embedCode.title ? (
@@ -27,7 +27,7 @@ export default function SectionWithHtmlCode(props) {
) : (
""
)}
- {embedCode.description && parse(embedCode.description)}
+ {typeof embedCode.description === "string" && parse(embedCode.description)}
);
diff --git a/package-lock.json b/package-lock.json
index 0b713b7..9fdc103 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "contentstack-nextjs-starter-app",
- "version": "1.1.0",
+ "version": "1.2.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 6d1ff03..c5a8d45 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "contentstack-nextjs-starter-app",
"description": "A starter app for Contentstack and Nextjs",
- "version": "1.1.1",
+ "version": "1.2.0",
"private": true,
"author": "Contentstack",
"scripts": {
diff --git a/pages/about-us.jsx b/pages/about-us.jsx
index 165f734..b2aabb2 100644
--- a/pages/about-us.jsx
+++ b/pages/about-us.jsx
@@ -22,12 +22,20 @@ export default function About(props) {
export async function getServerSideProps(context) {
try {
- const result = await Stack.getEntryByUrl("page", context.resolvedUrl);
- const header = await Stack.getEntry(
- "header",
- "navigation_menu.page_reference",
- );
- const footer = await Stack.getEntry("footer");
+ const result = await Stack.getEntryByUrl({
+ contentTypeUid: "page",
+ entryUrl: context.resolvedUrl,
+ jsonRtePath: ["page_components.section_with_buckets.buckets.description"],
+ });
+ const header = await Stack.getEntry({
+ contentTypeUid: "header",
+ referenceFieldPath: ["navigation_menu.page_reference"],
+ jsonRtePath: ["notification_bar.announcement_text"],
+ });
+ const footer = await Stack.getEntry({
+ contentTypeUid: "footer",
+ jsonRtePath: ["copyright"],
+ });
return {
props: {
header: header[0][0],
diff --git a/pages/blog/[...post].jsx b/pages/blog/[...post].jsx
index 20daeff..c242238 100644
--- a/pages/blog/[...post].jsx
+++ b/pages/blog/[...post].jsx
@@ -8,9 +8,7 @@ import RenderComponents from "../../components/render-components";
import ArchiveRelative from "../../components/archive-relative";
export default function BlogPost(props) {
- const {
- header, banner, footer, result,
- } = props;
+ const { header, banner, footer, result } = props;
return (