on 4fdc19d help sign in
urbit.org/components/PageWithIndex.js
42 lines 1.2 kB history raw
1import { useRouter } from "next/router";
2import Head from "next/head";
3import Meta from "../components/Meta";
4import ErrorPage from "../pages/404";
5import Container from "./Container";
6import Header from "./Header";
7import Footer from "./Footer";
8import SingleColumn from "./SingleColumn";
9import Section from "./Section";
10import { decode } from "html-entities";
11import { TableOfContents } from "./TableOfContents";
13export default function PageWithIndex({ post, markdown, search }) {
14 const router = useRouter();
15 if (!router.isFallback && !post?.slug) {
16 return <ErrorPage />;
17 }
18 return (
19 <Container>
20 <Head>
21 <title>Urbit • {post.title}</title>
22 {Meta(post)}
23 </Head>
24 <SingleColumn>
25 <Header search={search} />
26 <Section narrow>
27 <h1>{post.title}</h1>
28 </Section>
29 <Section narrow>
30 <div className="flex sidebar">
31 <article
32 className={"markdown pr-0 lg:pr-16"}
33 dangerouslySetInnerHTML={{ __html: decode(markdown) }}
34 ></article>
35 <TableOfContents />
36 </div>
37 </Section>
38 </SingleColumn>
39 <Footer />
40 </Container>
41 );