upstream #1
@ -1,53 +1,31 @@
|
|||||||
import { NextSeo, ArticleJsonLd } from 'next-seo'
|
import Head from 'next/head'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
import siteMetadata from '@/data/siteMetadata'
|
import siteMetadata from '@/data/siteMetadata'
|
||||||
|
|
||||||
export const SEO = {
|
export const PageSeo = ({ title, description }) => {
|
||||||
title: siteMetadata.title,
|
const router = useRouter()
|
||||||
description: siteMetadata.description,
|
|
||||||
openGraph: {
|
|
||||||
type: 'website',
|
|
||||||
locale: siteMetadata.language,
|
|
||||||
url: siteMetadata.siteUrl,
|
|
||||||
title: siteMetadata.title,
|
|
||||||
description: siteMetadata.description,
|
|
||||||
images: [
|
|
||||||
{
|
|
||||||
url: `${siteMetadata.siteUrl}${siteMetadata.socialBanner}`,
|
|
||||||
alt: siteMetadata.title,
|
|
||||||
width: 1200,
|
|
||||||
height: 600,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
twitter: {
|
|
||||||
handle: siteMetadata.twitter,
|
|
||||||
site: siteMetadata.twitter,
|
|
||||||
cardType: 'summary_large_image',
|
|
||||||
},
|
|
||||||
additionalMetaTags: [
|
|
||||||
{
|
|
||||||
name: 'author',
|
|
||||||
content: siteMetadata.author,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PageSeo = ({ title, description, url }) => {
|
|
||||||
return (
|
return (
|
||||||
<NextSeo
|
<Head>
|
||||||
title={`${title} – ${siteMetadata.title}`}
|
<title>{`${title}`}</title>
|
||||||
description={description}
|
<meta name="robots" content="follow, index" />
|
||||||
canonical={url}
|
<meta name="description" content={description} />
|
||||||
openGraph={{
|
<meta property="og:url" content={`${siteMetadata.siteUrl}${router.asPath}`} />
|
||||||
url,
|
<meta property="og:type" content="website" />
|
||||||
title,
|
<meta property="og:site_name" content={siteMetadata.title} />
|
||||||
description,
|
<meta property="og:description" content={description} />
|
||||||
}}
|
<meta property="og:title" content={title} />
|
||||||
/>
|
<meta property="og:image" content={`${siteMetadata.siteUrl}${siteMetadata.socialBanner}`} />
|
||||||
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
<meta name="twitter:site" content={siteMetadata.twitter} />
|
||||||
|
<meta name="twitter:title" content={title} />
|
||||||
|
<meta name="twitter:description" content={description} />
|
||||||
|
<meta name="twitter:image" content={`${siteMetadata.siteUrl}${siteMetadata.socialBanner}`} />
|
||||||
|
</Head>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BlogSeo = ({ title, summary, date, lastmod, url, tags, images = [] }) => {
|
export const BlogSeo = ({ title, summary, date, lastmod, images = [] }) => {
|
||||||
|
const router = useRouter()
|
||||||
const publishedAt = new Date(date).toISOString()
|
const publishedAt = new Date(date).toISOString()
|
||||||
const modifiedAt = new Date(lastmod || date).toISOString()
|
const modifiedAt = new Date(lastmod || date).toISOString()
|
||||||
let imagesArr =
|
let imagesArr =
|
||||||
@ -66,40 +44,27 @@ export const BlogSeo = ({ title, summary, date, lastmod, url, tags, images = []
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<NextSeo
|
<Head>
|
||||||
title={`${title} – ${siteMetadata.title}`}
|
<title>{`${title}`}</title>
|
||||||
description={summary}
|
<meta name="robots" content="follow, index" />
|
||||||
canonical={url}
|
<meta name="description" content={summary} />
|
||||||
openGraph={{
|
<meta property="og:url" content={`${siteMetadata.siteUrl}${router.asPath}`} />
|
||||||
type: 'article',
|
<meta property="og:type" content="article" />
|
||||||
article: {
|
<meta property="og:site_name" content={siteMetadata.title} />
|
||||||
publishedTime: publishedAt,
|
<meta property="og:description" content={summary} />
|
||||||
modifiedTime: modifiedAt,
|
<meta property="og:title" content={title} />
|
||||||
authors: [`${siteMetadata.siteUrl}/about`],
|
{featuredImages.map((img) => (
|
||||||
tags,
|
<meta property="og:image" content={img.url} key={img.url} />
|
||||||
},
|
))}
|
||||||
url,
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
title,
|
<meta name="twitter:site" content={siteMetadata.twitter} />
|
||||||
description: summary,
|
<meta name="twitter:title" content={title} />
|
||||||
images: featuredImages,
|
<meta name="twitter:description" content={summary} />
|
||||||
}}
|
<meta name="twitter:image" content={featuredImages[0].url} />
|
||||||
additionalMetaTags={[
|
{date && <meta property="article:published_time" content={publishedAt} />}
|
||||||
{
|
{lastmod && <meta property="article:modified_time" content={modifiedAt} />}
|
||||||
name: 'twitter:image',
|
<link rel="canonical" href={`${siteMetadata.siteUrl}${router.asPath}`} />
|
||||||
content: featuredImages[0].url,
|
</Head>
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
<ArticleJsonLd
|
|
||||||
authorName={siteMetadata.author}
|
|
||||||
dateModified={modifiedAt}
|
|
||||||
datePublished={publishedAt}
|
|
||||||
description={summary}
|
|
||||||
images={featuredImages}
|
|
||||||
publisherName={siteMetadata.author}
|
|
||||||
title={title}
|
|
||||||
url={url}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,7 @@ export default function AuthorLayout({ children, frontMatter }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={`About - ${name}`} description={`About me - ${name}`} />
|
||||||
title={`About - ${name}`}
|
|
||||||
description={`About me - ${name}`}
|
|
||||||
url={`${siteMetadata.siteUrl}/about`}
|
|
||||||
/>
|
|
||||||
<div className="divide-y">
|
<div className="divide-y">
|
||||||
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
||||||
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -5397,11 +5397,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"next-seo": {
|
|
||||||
"version": "4.24.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/next-seo/-/next-seo-4.24.0.tgz",
|
|
||||||
"integrity": "sha512-9VQXfXAelhE+hAWzJ4azigQaW3FPX0kU0eYKFQXKsQjgY7AWtukjRGXls0oSIk8khhDJwmCt46EwsO9n5DDW6Q=="
|
|
||||||
},
|
|
||||||
"next-themes": {
|
"next-themes": {
|
||||||
"version": "0.0.14",
|
"version": "0.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.0.14.tgz",
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
"image-size": "1.0.0",
|
"image-size": "1.0.0",
|
||||||
"next": "10.2.3",
|
"next": "10.2.3",
|
||||||
"next-mdx-remote": "^3.0.1",
|
"next-mdx-remote": "^3.0.1",
|
||||||
"next-seo": "4.24.0",
|
|
||||||
"next-themes": "^0.0.14",
|
"next-themes": "^0.0.14",
|
||||||
"postcss": "^8.2.15",
|
"postcss": "^8.2.15",
|
||||||
"preact": "^10.5.13",
|
"preact": "^10.5.13",
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import '@/css/tailwind.css'
|
import '@/css/tailwind.css'
|
||||||
|
|
||||||
import { ThemeProvider } from 'next-themes'
|
import { ThemeProvider } from 'next-themes'
|
||||||
import { DefaultSeo } from 'next-seo'
|
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
|
|
||||||
import { SEO } from '@/components/SEO'
|
|
||||||
import LayoutWrapper from '@/components/LayoutWrapper'
|
import LayoutWrapper from '@/components/LayoutWrapper'
|
||||||
|
|
||||||
export default function App({ Component, pageProps }) {
|
export default function App({ Component, pageProps }) {
|
||||||
@ -13,7 +11,6 @@ export default function App({ Component, pageProps }) {
|
|||||||
<Head>
|
<Head>
|
||||||
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
||||||
</Head>
|
</Head>
|
||||||
<DefaultSeo {...SEO} />
|
|
||||||
<LayoutWrapper>
|
<LayoutWrapper>
|
||||||
<Component {...pageProps} />
|
<Component {...pageProps} />
|
||||||
</LayoutWrapper>
|
</LayoutWrapper>
|
||||||
|
@ -3,7 +3,7 @@ import siteMetadata from '@/data/siteMetadata'
|
|||||||
import ListLayout from '@/layouts/ListLayout'
|
import ListLayout from '@/layouts/ListLayout'
|
||||||
import { PageSeo } from '@/components/SEO'
|
import { PageSeo } from '@/components/SEO'
|
||||||
|
|
||||||
export const POSTS_PER_PAGE = 10
|
export const POSTS_PER_PAGE = 5
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
const posts = await getAllFilesFrontMatter('blog')
|
const posts = await getAllFilesFrontMatter('blog')
|
||||||
@ -19,11 +19,7 @@ export async function getStaticProps() {
|
|||||||
export default function Blog({ posts, initialDisplayPosts, pagination }) {
|
export default function Blog({ posts, initialDisplayPosts, pagination }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={`Blog - ${siteMetadata.author}`} description={siteMetadata.description} />
|
||||||
title={`Blog - ${siteMetadata.author}`}
|
|
||||||
description={siteMetadata.description}
|
|
||||||
url={`${siteMetadata.siteUrl}/blog`}
|
|
||||||
/>
|
|
||||||
<ListLayout
|
<ListLayout
|
||||||
posts={posts}
|
posts={posts}
|
||||||
initialDisplayPosts={initialDisplayPosts}
|
initialDisplayPosts={initialDisplayPosts}
|
||||||
|
@ -44,11 +44,7 @@ export async function getStaticProps(context) {
|
|||||||
export default function PostPage({ posts, initialDisplayPosts, pagination }) {
|
export default function PostPage({ posts, initialDisplayPosts, pagination }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={siteMetadata.title} description={siteMetadata.description} />
|
||||||
title={siteMetadata.title}
|
|
||||||
description={siteMetadata.description}
|
|
||||||
url={`${siteMetadata.siteUrl}/blog/${pagination.currentPage}`}
|
|
||||||
/>
|
|
||||||
<ListLayout
|
<ListLayout
|
||||||
posts={posts}
|
posts={posts}
|
||||||
initialDisplayPosts={initialDisplayPosts}
|
initialDisplayPosts={initialDisplayPosts}
|
||||||
|
@ -16,11 +16,7 @@ export async function getStaticProps() {
|
|||||||
export default function Home({ posts }) {
|
export default function Home({ posts }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={siteMetadata.title} description={siteMetadata.description} />
|
||||||
title={siteMetadata.title}
|
|
||||||
description={siteMetadata.description}
|
|
||||||
url={siteMetadata.siteUrl}
|
|
||||||
/>
|
|
||||||
<div className="divide-y divide-gray-200 dark:divide-gray-700">
|
<div className="divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
||||||
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
||||||
|
@ -8,11 +8,7 @@ import { PageSeo } from '@/components/SEO'
|
|||||||
export default function Projects() {
|
export default function Projects() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={`Projects - ${siteMetadata.author}`} description={siteMetadata.description} />
|
||||||
title={`Projects - ${siteMetadata.author}`}
|
|
||||||
description={siteMetadata.description}
|
|
||||||
url={`${siteMetadata.siteUrl}/projects`}
|
|
||||||
/>
|
|
||||||
<div className="divide-y divide-gray-200 dark:divide-gray-700">
|
<div className="divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
|
||||||
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14">
|
||||||
|
@ -15,11 +15,7 @@ export default function Tags({ tags }) {
|
|||||||
const sortedTags = Object.keys(tags).sort((a, b) => tags[b] - tags[a])
|
const sortedTags = Object.keys(tags).sort((a, b) => tags[b] - tags[a])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageSeo
|
<PageSeo title={`Tags - ${siteMetadata.author}`} description="Things I blog about" />
|
||||||
title={`Tags - ${siteMetadata.author}`}
|
|
||||||
description="Things I blog about"
|
|
||||||
url={`${siteMetadata.siteUrl}/tags`}
|
|
||||||
/>
|
|
||||||
<div className="flex flex-col items-start justify-start divide-y divide-gray-200 dark:divide-gray-700 md:justify-center md:items-center md:divide-y-0 md:flex-row md:space-x-6 md:mt-24">
|
<div className="flex flex-col items-start justify-start divide-y divide-gray-200 dark:divide-gray-700 md:justify-center md:items-center md:divide-y-0 md:flex-row md:space-x-6 md:mt-24">
|
||||||
<div className="pt-6 pb-8 space-x-2 md:space-y-5">
|
<div className="pt-6 pb-8 space-x-2 md:space-y-5">
|
||||||
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14 md:border-r-2 md:px-6">
|
<h1 className="text-3xl font-extrabold leading-9 tracking-tight text-gray-900 dark:text-gray-100 sm:text-4xl sm:leading-10 md:text-6xl md:leading-14 md:border-r-2 md:px-6">
|
||||||
|
@ -46,7 +46,6 @@ export default function Tag({ posts, tag }) {
|
|||||||
<PageSeo
|
<PageSeo
|
||||||
title={`${tag} - ${siteMetadata.title}`}
|
title={`${tag} - ${siteMetadata.title}`}
|
||||||
description={`${tag} tags - ${siteMetadata.title}`}
|
description={`${tag} tags - ${siteMetadata.title}`}
|
||||||
url={`${siteMetadata.siteUrl}/tags/${tag}`}
|
|
||||||
/>
|
/>
|
||||||
<ListLayout posts={posts} title={title} />
|
<ListLayout posts={posts} title={title} />
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user