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