1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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

This commit is contained in:
Márcio Vinícius Oliveira Sena 2017-09-12 09:55:40 -03:00 committed by Tim Neutkens
parent 27f517d27d
commit 87d7ad2fc0
2 changed files with 26 additions and 1 deletions

View file

@ -31,7 +31,8 @@ export default class extends Document {
htmlAttributes={{lang: 'en'}} htmlAttributes={{lang: 'en'}}
title='Hello next.js!' title='Hello next.js!'
meta={[ 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!' }
]} ]}
/>) />)
} }

View file

@ -0,0 +1,24 @@
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>
)
}
}