From 2ccb3e5bc68de717ac9746ee3db8a8f4f0cab690 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Sun, 13 Nov 2022 22:28:00 -0700 Subject: [PATCH] test --- src/pages/[...slug].tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pages/[...slug].tsx b/src/pages/[...slug].tsx index 2b484eb52d..2605cfcc09 100644 --- a/src/pages/[...slug].tsx +++ b/src/pages/[...slug].tsx @@ -4,7 +4,7 @@ import yaml from 'js-yaml'; import ReactMarkdown from 'react-markdown'; import { Heading } from '@chakra-ui/react'; import MDXComponents from '../components/'; - +import { ParsedUrlQuery } from 'querystring'; import type { GetStaticPaths, GetStaticProps, NextPage } from 'next'; const MATTER_OPTIONS = { @@ -38,15 +38,10 @@ export const getStaticPaths: GetStaticPaths = () => { }; }; -interface Context { - params: { - slug: string[]; - } -} - // Reads file data for markdown pages -export const getStaticProps: GetStaticProps = async (context: Context) => { - const filePath = context.params.slug.join('/') +export const getStaticProps: GetStaticProps = async context => { + const { slug } = context.params as ParsedUrlQuery + const filePath = (slug as string[])!.join('/') let file try {