Advertisement
Guest User

articles/[slug]/page.js

a guest
Nov 20th, 2023
424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { getPostBySlug } from '@/lib/mdx'
  2. import {Card, CardHeader, CardBody, CardFooter, Divider, Link, Image} from "@nextui-org/react";
  3.  
  4.  
  5. const getPageContent = async slug => {
  6.   const { meta, content } = await getPostBySlug(slug)
  7.   return { meta, content }
  8. }
  9.  
  10. export async function generateMetadata({ params }) {
  11.   const { meta } = await getPageContent(params.slug)
  12.   return { title: meta.title }
  13. }
  14.  
  15. const Page = async ({ params }) => {
  16.   const { content } = await getPageContent(params.slug)
  17.  
  18.   return (
  19.     // <section className='py-24'>
  20.     <section className="xl:col-start-2 xl:col-span-3  lg:col-span-3 col-span-5 px-5 pt-11">
  21.  
  22.       <div className='Ads-block p-4 mb-5 bg-slate-400 rounded-xl'>
  23.         <p>This is the Advertisment Block</p>
  24.       </div>
  25.  
  26.  
  27.       <Card className="max-w-[400px]">
  28.         <CardHeader className="flex gap-3">
  29.           <Image
  30.             alt="nextui logo"
  31.             height={40}
  32.             radius="sm"
  33.             src="https://avatars.githubusercontent.com/u/86160567?s=200&v=4"
  34.             width={40}
  35.           />
  36.           <div className="flex flex-col">
  37.             <p className="text-md">NextUI</p>
  38.             <p className="text-small text-default-500">nextui.org</p>
  39.           </div>
  40.         </CardHeader>
  41.         <Divider/>
  42.         <CardBody>
  43.           <p>Make beautiful websites regardless of your design experience.</p>
  44.         </CardBody>
  45.         <Divider/>
  46.         <CardFooter>
  47.           <Link
  48.             isExternal
  49.             showAnchorIcon
  50.             href="https://github.com/nextui-org/nextui"
  51.           >
  52.             Visit source code on GitHub.
  53.           </Link>
  54.         </CardFooter>
  55.       </Card>
  56.      
  57.      
  58.       <div className='container py-4 prose prose-headings:text-slate-900 prose-p:text-slate-700 dark:prose-headings:text-slate-100 dark:prose-p:text-slate-300'>{content}</div>
  59.     </section>
  60.     //</section>
  61.   )
  62. }
  63.  
  64. export default Page
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement