temporary blog shortcut
This commit is contained in:
parent
6f64d80170
commit
fcefb69790
@ -2,7 +2,7 @@ import { BlitzPage, GetStaticPaths, GetStaticProps, Head, useRouter } from "blit
|
|||||||
import ErrorPage from "next/error";
|
import ErrorPage from "next/error";
|
||||||
|
|
||||||
import type { Post } from "integrations/datocms";
|
import type { Post } from "integrations/datocms";
|
||||||
import { getAllPostsWithSlug, getPostAndMorePosts, markdownToHtml } from "integrations/datocms";
|
import { getAllPostsWithSlug, getPostAndMorePosts } from "integrations/datocms";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
@ -63,7 +63,7 @@ export const getStaticProps: GetStaticProps = async ({ params, preview = false }
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = await getPostAndMorePosts(params.slug, preview);
|
const data = await getPostAndMorePosts(params.slug, preview);
|
||||||
const content = await markdownToHtml(data.post.content || "");
|
const content = /*await markdownToHtml(data.post.content || "");*/ "";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { getConfig } from "blitz";
|
import { getConfig } from "blitz";
|
||||||
import { remark } from "remark";
|
|
||||||
import html from "remark-html";
|
|
||||||
|
|
||||||
export async function markdownToHtml(markdown: string) {
|
export async function markdownToHtml(markdown: string) {
|
||||||
|
const { remark } = await import("remark");
|
||||||
|
const { default: html } = await import("remark-html");
|
||||||
const result = await remark().use(html).process(markdown);
|
const result = await remark().use(html).process(markdown);
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user