Skip to content

Commit

Permalink
update meta data of page blok
Browse files Browse the repository at this point in the history
  • Loading branch information
the-kwisatz-haderach committed Jan 15, 2024
1 parent 78b2b55 commit e2609b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
15 changes: 9 additions & 6 deletions components/StoryBlok/PageBlok/PageBlok.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { StoryblokComponent, storyblokEditable } from '@storyblok/react'
import Head from 'next/head'
import { ReactElement } from 'react'
import { BlokType } from '../../../lib/storyblok/types'
import { BlokType, IPageBlok } from '../../../lib/storyblok/types'

export interface Props {
blok: BlokType<{
description: string
title: string
body: BlokType[]
}>
blok: BlokType<IPageBlok>
}

export default function Page({ blok }: Props): ReactElement {
Expand All @@ -33,6 +29,13 @@ export default function Page({ blok }: Props): ReactElement {
content={blok.description}
/>
)}
{blok.meta_image?.filename && (
<meta
key="og-image"
property="og:image"
content={blok.meta_image.filename}
/>
)}
</Head>
<div {...storyblokEditable(blok)}>
{blok.body
Expand Down
1 change: 1 addition & 0 deletions lib/storyblok/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface LinkField {
export interface ImageField {
alt: string
copyright: string
content_type: 'jpg'
fieldtype: 'asset'
filename: string
focus: null
Expand Down
7 changes: 7 additions & 0 deletions lib/storyblok/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ export type PageStory = Story<{
title?: string
}>

export interface IPageBlok {
body?: StoryBlokComponent[]
description?: string
title?: string
meta_image?: ImageField
}

export interface IPost {
title: string
image: string
Expand Down

0 comments on commit e2609b0

Please sign in to comment.