Skip to content

Commit

Permalink
feat: add next-seo and default config
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloanan committed Mar 3, 2022
1 parent f44d467 commit 850ac55
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
24 changes: 24 additions & 0 deletions next-seo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @ts-check

/**
* @type {import('next-seo').NextSeoProps}
*/
const defaultSEOConfig = {
title: "Angelo's NextJS Template",
titleTemplate: "%s | Angelo's NextJS Template",

openGraph: {
type: 'website',
locale: 'en_US',
url: process.env.SITE_URL ?? 'https://angeloanan.xyz',
site_name: "Angelo's NextJS Template"
},

twitter: {
handle: '@uwungelo',
site: '@uwungelo',
cardType: 'summary_large_image'
}
}

export default defaultSEOConfig
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"autoprefixer": "^10.4.0",
"next": "^12.1.0",
"next-compose-plugins": "^2.2.1",
"next-seo": "^5.1.0",
"postcss": "^8.4.7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
13 changes: 10 additions & 3 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import '../style/globals.css'

import type { NextPage } from 'next'
import type { AppProps } from 'next/app'
import { DefaultSeo } from 'next-seo'

import SEOConfig from '../../next-seo.config'

type CustomAppProps = AppProps & {
Component: NextPage & {
Expand All @@ -14,9 +17,13 @@ function CustomApp({ Component, pageProps }: CustomAppProps) {
return Component.disableLayout ? (
<Component {...pageProps} />
) : (
<div className='stylized-bg min-h-screen'>
<Component {...pageProps} />
</div>
<>
<DefaultSeo {...SEOConfig} />

<div className='stylized-bg min-h-screen'>
<Component {...pageProps} />
</div>
</>
)
}

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,11 @@ next-compose-plugins@^2.2.1:
resolved "https://registry.yarnpkg.com/next-compose-plugins/-/next-compose-plugins-2.2.1.tgz#020fc53f275a7e719d62521bef4300fbb6fde5ab"
integrity sha512-OjJ+fV15FXO2uQXQagLD4C0abYErBjyjE0I0FHpOEIB8upw0hg1ldFP6cqHTJBH1cZqy96OeR3u1dJ+Ez2D4Bg==

next-seo@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/next-seo/-/next-seo-5.1.0.tgz#aa9fd6249a11bf93e6da06fa2a6bc89268936edf"
integrity sha512-ampuQfNTOi1x+xtRIb6CZGunIo6rQXtMo2Tyu861d5GjJFIwfOXsA4lzCa4+e2rLkyXDyVpavNNUZWa3US9ELw==

next-sitemap@^2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/next-sitemap/-/next-sitemap-2.5.4.tgz#a48498d495b603043b5322878501cf4069b827ef"
Expand Down

0 comments on commit 850ac55

Please sign in to comment.