From c4321f3009e0d6a270bcde077bf45547d5547f69 Mon Sep 17 00:00:00 2001 From: khalilcodes Date: Fri, 13 May 2022 02:35:22 +0300 Subject: [PATCH] [site/pages][s]: move seo component and logic to MDX component --- site/pages/[...slug].js | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/site/pages/[...slug].js b/site/pages/[...slug].js index a56bf14..8a15d62 100644 --- a/site/pages/[...slug].js +++ b/site/pages/[...slug].js @@ -1,8 +1,6 @@ import MdxPage from '../components/MDX'; import { allOtherPages } from 'contentlayer/generated'; import { useMDXComponent } from 'next-contentlayer/hooks'; -import { NextSeo } from 'next-seo'; -import siteConfig from "../config/siteConfig" export default function Page({ body, ...rest }) { @@ -15,38 +13,9 @@ export default function Page({ body, ...rest }) { created: rest.created === "Invalid Date" ? null : rest.created }, }; - - const titleFromUrl = rest._raw.flattenedPath - .split("/") - .pop() - .replace(/-/g, " ") - // capitalize first char of each word - .replace(/(^\w{1})|(\s{1}\w{1})/g, (str) => str.toUpperCase()); - - const title = children.frontmatter.title ?? titleFromUrl - const imageUrl = siteConfig.url + children.frontmatter.image return ( - <> - - - + ); }