mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
33 lines
883 B
JavaScript
33 lines
883 B
JavaScript
|
/**
|
||
|
* Using a custom _app.js with next-seo you can set default SEO
|
||
|
* that will apply to every page. Full info on how the default works
|
||
|
* can be found here: https://github.com/garmeeh/next-seo#default-seo-configuration
|
||
|
*/
|
||
|
import App, { Container } from 'next/app'
|
||
|
import React from 'react'
|
||
|
import NextSeo from 'next-seo'
|
||
|
|
||
|
import SEO from '../next-seo.config'
|
||
|
|
||
|
export default class MyApp extends App {
|
||
|
static async getInitialProps ({ Component, ctx }) {
|
||
|
let pageProps = {}
|
||
|
if (Component.getInitialProps) {
|
||
|
pageProps = await Component.getInitialProps(ctx)
|
||
|
}
|
||
|
|
||
|
return { pageProps }
|
||
|
}
|
||
|
|
||
|
render () {
|
||
|
const { Component, pageProps } = this.props
|
||
|
return (
|
||
|
<Container>
|
||
|
{/* Here we call NextSeo and pass our default configuration to it */}
|
||
|
<NextSeo config={SEO} />
|
||
|
<Component {...pageProps} />
|
||
|
</Container>
|
||
|
)
|
||
|
}
|
||
|
}
|