Skip to content

Commit

Permalink
meta + other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonappah committed May 7, 2023
1 parent 3b42593 commit c2cb7dd
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 35 deletions.
22 changes: 20 additions & 2 deletions app/docs/[page]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { NotionAPI } from 'notion-client';
import { getAllPagesInSpace, getPageTitle, parsePageId } from 'notion-utils';

import { notFound, redirect } from 'next/navigation';
import { notFound, redirect, useRouter } from 'next/navigation';
import { Metadata } from 'next';
import Signature from '../../../components/Signature';
import NotionRenderer from '../../../components/Notion';

const notion = new NotionAPI();

export const revalidate = 60;

async function Page({ params }: { params: { page: string } }) {
type Props = { params: { page: string } };
async function Page({ params }: Props) {
const { page } = params;
const id = parsePageId(page);
if (id !== page) return redirect(id);
Expand All @@ -18,6 +20,7 @@ async function Page({ params }: { params: { page: string } }) {
if (!recordMap) return notFound();

const title = getPageTitle(recordMap);
// console.log(recordMap.block)

return (
<div className="flex flex-col gap-8 w-screen px-24 items-center">
Expand Down Expand Up @@ -57,4 +60,19 @@ export async function generateStaticParams() {
return paths.map((path) => ({ page: path }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { page } = params;
const id = parsePageId(page);
if (id !== page) return redirect(id);

const recordMap = await notion.getPage(id);
if (!recordMap) return notFound();

const title = getPageTitle(recordMap);

return {
title,
};
}

export default Page;
9 changes: 3 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Metadata } from 'next';
import '../styles/globals.css';
import localFont from "next/font/local";
import localFont from 'next/font/local';
import AnalyticsWrapper from '../components/Analytics';

import styles from '../styles/palettes.module.css';
Expand Down Expand Up @@ -36,13 +36,10 @@ export const metadata: Metadata = {
title: 'Jason Antwi-Appah',
creator: 'Jason Antwi-Appah',
description: "Hi! I'm a student and maker that loves all sorts of tech.",
icons: {
icon: '/favicon.png',
},
openGraph: {
type: 'website',
title: 'Jason Antwi-Appah',
description: "Hi! I'm a student and maker that loves all sorts of tech.",
title: { default: 'Jason Antwi-Appah', template: '%s | Jason Antwi-Appah' },
description: '🛠️ 👨🏾‍💻 🎓 ✨',
url: 'https://jasonaa.me',
locale: 'en-US',
images: [
Expand Down
28 changes: 13 additions & 15 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ function Content() {
}`,
},
{
name: 'links',
name: 'more links',
href: '/links',
},
];
return (
<div className="flex flex-col items-start justify-center gap-4 max-w-2xl">
<Signature />
<p>
🧑🏾‍💻 Hey there! I&apos;m Jason Antwi-Appah. I&apos;m a 17-year-old student
and maker that loves all sorts of tech.
🧑🏾‍💻 Hey there! I&apos;m Jason Antwi-Appah. I&apos;m a student and
software engineer with a passion for building and learning about all
sorts of tech.
</p>
<p>
🛬 I was raised in London, but now live in Austin, TX and attend school
Expand All @@ -37,10 +38,10 @@ function Content() {
<p>
✨ Outside of software engineering, I love music production,
broadcast/audiovisual technology, and all things technical theatre!{' '}
<StyledLink href="https://scrapbook.hackclub.com/jasonaa">
{/* <StyledLink href="https://scrapbook.hackclub.com/jasonaa">
My Scrapbook
</StyledLink>{' '}
has some of the things I&apos;m working on.
has some of the things I&apos;m working on. */}
</p>

<p>
Expand All @@ -53,18 +54,15 @@ function Content() {
<StyledLink href="https://linkedin.com/in/jasonaa">LinkedIn</StyledLink>
.
</p>
<ol className="flex gap-3">
<ul className="flex gap-5 list-inside list-disc ">
{nav.map(({ name, href }) => (
<StyledLink key={name} href={href}>
{name}
</StyledLink>
<li className="first:list-none not-first:pl-5">
<StyledLink key={name} href={href}>
{name}
</StyledLink>
</li>
))}
</ol>
<p className="text-[0.01em]">
psssst if you&apos;re a teen interested in joining a community of other
teens in computer science or tech in general, you should check out{' '}
<StyledLink href="https://hackclub.com">Hack Club!</StyledLink>
</p>
</ul>
</div>
);
}
Expand Down
8 changes: 4 additions & 4 deletions components/Notion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'react-notion-x/src/styles.css';
// used for rendering equations (optional)
import 'katex/dist/katex.min.css';
// used for code syntax highlighting (optional)
import 'prismjs/themes/prism-tomorrow.css';
import 'prismjs/themes/prism-tomorrow.min.css';

import Image from 'next/image';
import Link from 'next/link';
Expand All @@ -18,15 +18,15 @@ const Code = dynamic(() =>
import('react-notion-x/build/third-party/code').then(async (m) => {
// additional prism syntaxes
await Promise.all([
import('prismjs/components/prism-markup-templating.js'),
import('prismjs/components/prism-markup.js'),
import('prismjs/components/prism-bash.js'),
import('prismjs/components/prism-markup-templating.js'),
import('prismjs/components/prism-c.js'),
import('prismjs/components/prism-js-templates.js'),
import('prismjs/components/prism-bash.js'),
import('prismjs/components/prism-cpp.js'),
import('prismjs/components/prism-csharp.js'),
import('prismjs/components/prism-docker.js'),
import('prismjs/components/prism-java.js'),
import('prismjs/components/prism-js-templates.js'),
import('prismjs/components/prism-coffeescript.js'),
import('prismjs/components/prism-diff.js'),
import('prismjs/components/prism-git.js'),
Expand Down
8 changes: 0 additions & 8 deletions next.config.js

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@babel/eslint-parser": "^7.16.3",
"@babel/preset-react": "^7.16.0",
"@types/node": "^16.11.12",
"@types/prismjs": "^1.26.0",
"@types/react": "^17.0.30",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
Expand Down
Binary file removed public/favicon.png
Binary file not shown.
5 changes: 5 additions & 0 deletions public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.26.tgz#a18b88726a67bc6a8a5bdac9a40c093ecb03ccd0"
integrity sha512-pCNBzNQqCXE4A6FWDmrn/o1Qu+qBf8tnorBlNoPNSBQJF+jXzvTKNI/aMiE+hGJbK5sDAD65g7OS/YwSHIEJdw==

"@types/prismjs@^1.26.0":
version "1.26.0"
resolved "https://registry.yarnpkg.com/@types/prismjs/-/prismjs-1.26.0.tgz#a1c3809b0ad61c62cac6d4e0c56d610c910b7654"
integrity sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==

"@types/prop-types@*":
version "15.7.5"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
Expand Down

1 comment on commit c2cb7dd

@vercel
Copy link

@vercel vercel bot commented on c2cb7dd May 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

v2 – ./

v2-git-main-jasonaa.vercel.app
v2-jasonaa.vercel.app
v2-one.vercel.app
jasonaa.me
v2.jasonaa.me

Please sign in to comment.