Add title to all pages #222

Merged
a3thakra merged 10 commits from adi-page-titles into main 2021-08-30 19:20:18 -04:00
1 changed files with 11 additions and 6 deletions
Showing only changes of commit 1751b312c0 - Show all commits

View File

@ -13,23 +13,26 @@ import {
getEventsByTerm, getEventsByTerm,
getEventBySlug, getEventBySlug,
} from "@/lib/events"; } from "@/lib/events";
import { capitalize } from "@/utils";
export default function EventInfoPage(props: Props) { export default function EventInfoPage({ year, term, event }: Props) {
return ( return (
<> <>
<Title>{props.event.metadata.name}</Title> <Title>{[event.metadata.name, `${capitalize(term)} ${year}`]}</Title>
<EventCard <EventCard
{...props.event.metadata} {...event.metadata}
date={new Date(props.event.metadata.date)} date={new Date(event.metadata.date)}
showDescription showDescription
> >
<MDXRemote {...props.event.content} /> <MDXRemote {...event.content} />
</EventCard> </EventCard>
</> </>
); );
} }
interface Props { interface Props {
year: string;
term: string;
event: Event; event: Event;
} }
@ -44,7 +47,9 @@ export const getStaticProps: GetStaticProps<Props, Params> = async (
) => { ) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { year, term, event } = context.params!; const { year, term, event } = context.params!;
return { props: { event: await getEventBySlug(year, term, event) } }; return {
props: { year, term, event: await getEventBySlug(year, term, event) },
};
}; };
export const getStaticPaths: GetStaticPaths<Params> = async () => { export const getStaticPaths: GetStaticPaths<Params> = async () => {