Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2a2e9005fd |
2 changed files with 22 additions and 3 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "www-aaronjy-me",
|
"name": "www-aaronjy-me",
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "www-aaronjy-me",
|
"name": "www-aaronjy-me",
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@highlightjs/cdn-assets": "^11.11.1",
|
"@highlightjs/cdn-assets": "^11.11.1",
|
||||||
"@mdx-js/mdx": "^3.1.0",
|
"@mdx-js/mdx": "^3.1.0",
|
||||||
|
|
|
@ -9,7 +9,25 @@ import { MDXClient } from "next-mdx-remote-client";
|
||||||
import { serialize } from "next-mdx-remote-client/serialize";
|
import { serialize } from "next-mdx-remote-client/serialize";
|
||||||
import { NextSeo } from "next-seo";
|
import { NextSeo } from "next-seo";
|
||||||
|
|
||||||
export async function getServerSideProps({ params }) {
|
export async function getStaticPaths() {
|
||||||
|
const res = await fetchBasicPages();
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new FailedFetchBasicPagesError();
|
||||||
|
}
|
||||||
|
|
||||||
|
const pages = (await res.json()).data;
|
||||||
|
const paths = pages.map((page) => {
|
||||||
|
return {
|
||||||
|
params: {
|
||||||
|
path: page.path?.split("/") ?? [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return { paths, fallback: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getStaticProps({ params }) {
|
||||||
const { path } = params;
|
const { path } = params;
|
||||||
const res = await fetchBasicPages([], {
|
const res = await fetchBasicPages([], {
|
||||||
path: {
|
path: {
|
||||||
|
@ -37,6 +55,7 @@ export async function getServerSideProps({ params }) {
|
||||||
title,
|
title,
|
||||||
mdxSource,
|
mdxSource,
|
||||||
},
|
},
|
||||||
|
revalidate: 60,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue