Commit 87d7ad2f authored by Márcio Vinícius Oliveira Sena's avatar Márcio Vinícius Oliveira Sena Committed by Tim Neutkens

Example: Overwriting meta tag with react-helmet (#2942)

parent 27f517d2
......@@ -31,7 +31,8 @@ export default class extends Document {
htmlAttributes={{lang: 'en'}}
title='Hello next.js!'
meta={[
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ property: 'og:title', content: 'Hello next.js!' }
]}
/>)
}
......
import React from 'react'
import Helmet from 'react-helmet'
export default class About extends React.Component {
static async getInitialProps ({ req }) {
if (req) {
Helmet.renderStatic()
}
return { title: 'About' }
}
render () {
const { title } = this.props
return (
<div>
<Helmet
title={`${title} | Hello next.js!`}
meta={[{ property: 'og:title', content: title }]}
/>
About the World
</div>
)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment