-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add meta property for `postHeader.tsx` * feat: update the meta data of blog * feat: update the meta data for blog
- Loading branch information
1 parent
ddaaa15
commit 94d4381
Showing
12 changed files
with
183 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,54 @@ | ||
import Image from "next/image"; | ||
import { usePathname } from "next/navigation"; | ||
import { getPagesUnderRoute } from "nextra/context"; | ||
import ROOCH_TEAM from "../../data/team"; | ||
import { useState, useEffect } from "react"; | ||
import Image from 'next/image' | ||
import { usePathname } from 'next/navigation' | ||
import { getPagesUnderRoute } from 'nextra/context' | ||
import ROOCH_TEAM from '../../data/team' | ||
import { useState, useEffect } from 'react' | ||
import Head from 'next/head' | ||
|
||
export default function PostHeader() { | ||
const pathname = usePathname(); | ||
|
||
const [page, setPage] = useState(null); | ||
const pathname = usePathname() | ||
const [page, setPage] = useState(null) | ||
|
||
useEffect(() => { | ||
setPage( | ||
getPagesUnderRoute("/blog").find((page) => page.route === pathname) | ||
); | ||
}, [pathname]); | ||
setPage(getPagesUnderRoute('/blog').find((page) => page.route === pathname)) | ||
}, [pathname]) | ||
|
||
return page ? ( | ||
<div className="text-center inline-block mx-auto w-full"> | ||
<h1 className="font-bold text-5xl mt-6">{page.frontMatter.title}</h1> | ||
<h2 className=" my-3 text-sm inline-flex gap-2 uppercase text-gray-500 dark:text-gray-300"> | ||
{page.frontMatter.category} | ||
{" | "} | ||
<Image | ||
src={ROOCH_TEAM[page.frontMatter.author].avatar} | ||
alt={page.frontMatter.author} | ||
width={20} | ||
height={20} | ||
className="rounded-full" | ||
/> | ||
<span className="font-semibold"> | ||
<a | ||
href={ | ||
"https://twitter.com/" + | ||
ROOCH_TEAM[page.frontMatter.author].twitterUsername | ||
} | ||
target="_blank" | ||
> | ||
{ROOCH_TEAM[page.frontMatter.author].name} | ||
</a> | ||
</span> | ||
</h2> | ||
</div> | ||
) : undefined; | ||
<> | ||
<Head> | ||
<title>{page.frontMatter.title}</title> | ||
<meta property="og:title" content={page.frontMatter.title} /> | ||
<meta property="og:description" content={page.frontMatter.description} /> | ||
<meta property="og:image" content={page.frontMatter.image} /> | ||
<meta property="og:type" content="article" /> | ||
<meta property="og:url" content={`https://rooch.network/${pathname}`} /> | ||
<meta property="twitter:card" content="summary_large_image" /> | ||
<meta property="twitter:title" content={page.frontMatter.title} /> | ||
<meta property="twitter:description" content={page.frontMatter.description} /> | ||
<meta property="twitter:image" content={page.frontMatter.image} /> | ||
</Head> | ||
<div className="text-center inline-block mx-auto w-full"> | ||
<h1 className="font-bold text-5xl mt-6">{page.frontMatter.title}</h1> | ||
<h2 className=" my-3 text-sm inline-flex gap-2 uppercase text-gray-500 dark:text-gray-300"> | ||
{page.frontMatter.category} | ||
{' | '} | ||
<Image | ||
src={ROOCH_TEAM[page.frontMatter.author].avatar} | ||
alt={page.frontMatter.author} | ||
width={20} | ||
height={20} | ||
className="rounded-full" | ||
/> | ||
<span className="font-semibold"> | ||
<a | ||
href={'https://twitter.com/' + ROOCH_TEAM[page.frontMatter.author].twitterUsername} | ||
target="_blank" | ||
> | ||
{ROOCH_TEAM[page.frontMatter.author].name} | ||
</a> | ||
</span> | ||
</h2> | ||
</div> | ||
</> | ||
) : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.