pull/26459/head^2
Corwin Smith 2 years ago
parent 67396c8d7e
commit 2ccb3e5bc6
  1. 13
      src/pages/[...slug].tsx

@ -4,7 +4,7 @@ import yaml from 'js-yaml';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import { Heading } from '@chakra-ui/react'; import { Heading } from '@chakra-ui/react';
import MDXComponents from '../components/'; import MDXComponents from '../components/';
import { ParsedUrlQuery } from 'querystring';
import type { GetStaticPaths, GetStaticProps, NextPage } from 'next'; import type { GetStaticPaths, GetStaticProps, NextPage } from 'next';
const MATTER_OPTIONS = { const MATTER_OPTIONS = {
@ -38,15 +38,10 @@ export const getStaticPaths: GetStaticPaths = () => {
}; };
}; };
interface Context {
params: {
slug: string[];
}
}
// Reads file data for markdown pages // Reads file data for markdown pages
export const getStaticProps: GetStaticProps = async (context: Context) => { export const getStaticProps: GetStaticProps = async context => {
const filePath = context.params.slug.join('/') const { slug } = context.params as ParsedUrlQuery
const filePath = (slug as string[])!.join('/')
let file let file
try { try {

Loading…
Cancel
Save