feat(SW-200): refactored breadcrumbs fetching and added json schema to layout
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { getBreadcrumbsListSchema } from "@/utils/getJsonSchemas"
|
||||
|
||||
import styles from "./layout.module.css"
|
||||
|
||||
import {
|
||||
@@ -7,7 +9,9 @@ import {
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
|
||||
export default function ContentTypeLayout({
|
||||
export { generateMetadata } from "@/utils/generateMetadata"
|
||||
|
||||
export default async function ContentTypeLayout({
|
||||
breadcrumbs,
|
||||
preview,
|
||||
children,
|
||||
@@ -17,13 +21,25 @@ export default function ContentTypeLayout({
|
||||
preview: React.ReactNode
|
||||
}
|
||||
>) {
|
||||
const breadcrumbsListSchema = await getBreadcrumbsListSchema()
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<section className={styles.layout}>
|
||||
{preview}
|
||||
{breadcrumbs}
|
||||
{children}
|
||||
</section>
|
||||
</div>
|
||||
<>
|
||||
{breadcrumbsListSchema ? (
|
||||
<script
|
||||
type={breadcrumbsListSchema.type}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: JSON.stringify(breadcrumbsListSchema.jsonLd),
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
<div className={styles.container}>
|
||||
<section className={styles.layout}>
|
||||
{preview}
|
||||
{breadcrumbs}
|
||||
{children}
|
||||
</section>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ import {
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
|
||||
export { generateMetadata } from "@/utils/generateMetadata"
|
||||
|
||||
export default function ContentTypePage({
|
||||
params,
|
||||
}: PageArgs<LangParams & ContentTypeParams & UIDParams, {}>) {
|
||||
|
||||
Reference in New Issue
Block a user