redo the NoJS stuff

This commit is contained in:
Lio 2023-05-27 10:57:07 +02:00
parent c652fd1575
commit ba9c217156
3 changed files with 53 additions and 49 deletions

View file

@ -15,10 +15,11 @@ const Post = (props: { post: string, slug: string, matter: any }) => {
// console.log(props.matter) // console.log(props.matter)
let Index = ( return (
<RenderWithoutJS>
<main id={index.layout}> <main id={index.layout}>
<Head> <Head>
<title>{props.matter}</title> <title>{props.matter.title} | lio's blog</title>
</Head> </Head>
<Sidebar /> <Sidebar />
<section id={index.main}> <section id={index.main}>
@ -38,8 +39,9 @@ const Post = (props: { post: string, slug: string, matter: any }) => {
</section> </section>
<Lanyard /> <Lanyard />
</main> </main>
</RenderWithoutJS>
); );
return <RenderWithoutJS children={Index} />
}; };
export default Post export default Post
@ -50,7 +52,7 @@ export async function getStaticProps(context: any) {
.process(await read(`${listFiles('./src/blog').find(file => file.includes(context.params.slug))}`)) .process(await read(`${listFiles('./src/blog').find(file => file.includes(context.params.slug))}`))
return { return {
props: { props: {
post: (post.value as string).replace(/(---)\n*([a-zA-Z0-9\/\[\]\"_:,\-\s*]*)*/mi, ""), post: (post.value as string).replace(/^(---)\n*([a-zA-Z0-9\/\#[\]\"_:,\-\s*]*)(---)$/mi, ""),
matter: matter(post.value).data, matter: matter(post.value).data,
slug: context.params.slug slug: context.params.slug
} }

View file

@ -9,10 +9,10 @@ import PostList from "@/components/PostList";
import Head from "next/head" import Head from "next/head"
const IndexPage = (props: { posts: [{ title: string, date: string, link: string }] }) => { const IndexPage = (props: { posts: [{ title: string, date: string, link: string }] }) => {
let Index = ( return (<RenderWithoutJS>
<main id={index.layout}> <main id={index.layout}>
<Head> <Head>
<title>blog</title> <title>lio's blog</title>
</Head> </Head>
<Sidebar /> <Sidebar />
<section id={index.blogMain}> <section id={index.blogMain}>
@ -22,8 +22,7 @@ const IndexPage = (props: { posts: [{ title: string, date: string, link: string
<Lanyard /> <Lanyard />
{/* <Copyright /> */} {/* <Copyright /> */}
</main> </main>
); </RenderWithoutJS>)
return <RenderWithoutJS children={Index} />
}; };
export default IndexPage export default IndexPage

View file

@ -13,7 +13,9 @@ function randomHello() {
const IndexPage = () => { const IndexPage = () => {
let Index = ( return (
<RenderWithoutJS>
<main id={index.layout}> <main id={index.layout}>
<Head> <Head>
<title>lio</title> <title>lio</title>
@ -34,8 +36,9 @@ const IndexPage = () => {
<Lanyard /> <Lanyard />
{/* <Copyright /> */} {/* <Copyright /> */}
</main> </main>
</RenderWithoutJS>
); );
return <RenderWithoutJS children={Index} />
}; };
export default IndexPage export default IndexPage