diff --git a/app/routes/blog.$slug.tsx b/app/routes/blog.$slug.tsx index cff5088..aeaf954 100644 --- a/app/routes/blog.$slug.tsx +++ b/app/routes/blog.$slug.tsx @@ -34,7 +34,15 @@ export async function loader({ params }: DataFunctionArgs) { ) } -export const meta: MetaFunction = ({ data, location }) => { +export const meta: MetaFunction = ({ data, location }) => { + if (!data) { + return getSocialMeta({ + ogType: 'article', + title: `Hemerson Carlin`, + url: location.pathname, + }) + } + const { post } = data return getSocialMeta({ diff --git a/app/routes/uses.tsx b/app/routes/uses.tsx index 869ef3e..5e50ce1 100644 --- a/app/routes/uses.tsx +++ b/app/routes/uses.tsx @@ -24,7 +24,15 @@ export async function loader() { ) } -export const meta: MetaFunction = ({ data, location }) => { +export const meta: MetaFunction = ({ data, location }) => { + if (!data) { + return getSocialMeta({ + ogType: 'article', + title: 'Uses - Hemerson Carlin', + url: location.pathname, + }) + } + const { post } = data return getSocialMeta({ diff --git a/app/utils/post.server.ts b/app/utils/post.server.ts index 510b00a..d9f62de 100644 --- a/app/utils/post.server.ts +++ b/app/utils/post.server.ts @@ -1,5 +1,4 @@ import fs from 'fs' -import path from 'path' import { bundleMDX } from 'mdx-bundler' import calculateReadingTime from 'reading-time' import type { Post } from '~/types' @@ -51,9 +50,9 @@ async function parseMdxAsBlogPost({ mdxOptions(options) { options.rehypePlugins = [ ...(options.rehypePlugins ?? []), - rehypeAutolinkHeadings, - rehypeHighlight, - rehypeSlug, + rehypeAutolinkHeadings as any, + rehypeHighlight as any, + rehypeSlug as any, ] return options