page meta
This commit is contained in:
1 parent
e42f739797
commit
d29bfbff89
1 file changed
+10
@@ -5,6 +5,8 @@ import App from '../src/components/App'
|
||||
import Page from '../src/components/Page'
|
||||
import menuModel from '../src/models/menu'
|
||||
import { buildMenu } from '../src/lib/menu'
|
||||
import { Meta } from '../src/components/Meta'
|
||||
import { meta } from '../src/lib/meta'
|
||||
|
||||
const Index = (props) => (
|
||||
<App
|
||||
@@ -14,6 +16,7 @@ const Index = (props) => (
|
||||
>
|
||||
<Head>
|
||||
<title>{props.title}</title>
|
||||
<Meta meta={props.meta} />
|
||||
</Head>
|
||||
|
||||
<div className={'content content_thin'}>
|
||||
@@ -32,11 +35,18 @@ Index.getInitialProps = async (ctx) => {
|
||||
const apiUrl = `http://localhost:3000/api/page?page=${pageUrl}`
|
||||
const res = await axios.get(apiUrl)
|
||||
const page = res.data
|
||||
const image = page.preview.artifacts.fb
|
||||
|
||||
return {
|
||||
content: page.data,
|
||||
pageUrl,
|
||||
title: page.title,
|
||||
meta: meta({
|
||||
title: page.title,
|
||||
image: image.src,
|
||||
imageWidth: image.width,
|
||||
imageHeight: image.height,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user