Skip to content

Instantly share code, notes, and snippets.

@haze-it
Created June 6, 2020 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haze-it/a020874eeb24705454da002ee2f1203a to your computer and use it in GitHub Desktop.
Save haze-it/a020874eeb24705454da002ee2f1203a to your computer and use it in GitHub Desktop.
import { GetStaticProps, GetStaticPaths } from "next";
import Loading from "../../components/loading";
import dayjs from 'dayjs';
type Props = {
id: string;
buildAt: string;
};
export const getStaticProps: GetStaticProps<Props> = async (context) => {
return {
props: {
id: context.params.id as string,
buildAt: dayjs().format('YYYY年MM月DD日 HH:mm:ss'),
},
unstable_revalidate: 10000,
};
};
export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: ["/mag/1"],
fallback: true,
};
};
export default (props: Props) => {
return (
<>
<p>{props.id}: Build At {props.buildAt}</p>
<p>version: 4</p>
<Loading />
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment