Skip to content

Commit

Permalink
Update types for meta function
Browse files Browse the repository at this point in the history
  • Loading branch information
mersocarlin committed Apr 14, 2024
1 parent e9dcbbc commit 9090f23
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
10 changes: 9 additions & 1 deletion app/routes/blog.$slug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ export async function loader({ params }: DataFunctionArgs) {
)
}

export const meta: MetaFunction = ({ data, location }) => {
export const meta: MetaFunction<typeof loader> = ({ data, location }) => {
if (!data) {
return getSocialMeta({
ogType: 'article',
title: `Hemerson Carlin`,
url: location.pathname,
})
}

const { post } = data

return getSocialMeta({
Expand Down
10 changes: 9 additions & 1 deletion app/routes/uses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ export async function loader() {
)
}

export const meta: MetaFunction = ({ data, location }) => {
export const meta: MetaFunction<typeof loader> = ({ data, location }) => {
if (!data) {
return getSocialMeta({
ogType: 'article',
title: 'Uses - Hemerson Carlin',
url: location.pathname,
})
}

const { post } = data

return getSocialMeta({
Expand Down
7 changes: 3 additions & 4 deletions app/utils/post.server.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9090f23

Please sign in to comment.