Dynamic permalinks
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
bed40fe10e
commit
f2df7541c0
|
@ -7,7 +7,7 @@ import { Link } from "./Link";
|
||||||
|
|
||||||
import styles from "./EventCard.module.css";
|
import styles from "./EventCard.module.css";
|
||||||
|
|
||||||
interface BaseProps {
|
interface EventCardProps {
|
||||||
name: string;
|
name: string;
|
||||||
short: string;
|
short: string;
|
||||||
date: Date;
|
date: Date;
|
||||||
|
@ -15,15 +15,13 @@ interface BaseProps {
|
||||||
location: string;
|
location: string;
|
||||||
poster?: string;
|
poster?: string;
|
||||||
registerLink?: string;
|
registerLink?: string;
|
||||||
|
permaLink: string;
|
||||||
|
showDescription?: boolean;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventCardProps =
|
|
||||||
| (BaseProps & { showDescription?: false; link: string })
|
|
||||||
| (BaseProps & { showDescription: true; link?: string });
|
|
||||||
|
|
||||||
export function EventCard({
|
export function EventCard({
|
||||||
link,
|
permaLink,
|
||||||
name,
|
name,
|
||||||
date,
|
date,
|
||||||
online,
|
online,
|
||||||
|
@ -60,8 +58,8 @@ export function EventCard({
|
||||||
<h2>
|
<h2>
|
||||||
<EventSetting date={date} online={online} location={location} />
|
<EventSetting date={date} online={online} location={location} />
|
||||||
</h2>
|
</h2>
|
||||||
{!showDescription && link && (
|
{!showDescription && (
|
||||||
<Link href={link}>
|
<Link href={permaLink}>
|
||||||
<span className={styles.mobileLearnMore}>Learn more</span>
|
<span className={styles.mobileLearnMore}>Learn more</span>
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -16,7 +16,7 @@ interface Props {
|
||||||
date: Date;
|
date: Date;
|
||||||
poster?: string;
|
poster?: string;
|
||||||
registerLink?: string;
|
registerLink?: string;
|
||||||
permaLink?: string;
|
permaLink: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ export function EventDescriptionCard({
|
||||||
<EventSetting date={date} online={online} location={location} />
|
<EventSetting date={date} online={online} location={location} />
|
||||||
</h2>
|
</h2>
|
||||||
<p className={styles.desc}>{short}</p>
|
<p className={styles.desc}>{short}</p>
|
||||||
{permaLink && <Link href={permaLink}>Learn more</Link>}
|
<Link href={permaLink}>Learn more</Link>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
{registerLink && (
|
{registerLink && (
|
||||||
|
|
|
@ -6,7 +6,6 @@ online: true
|
||||||
location: 'Twitch'
|
location: 'Twitch'
|
||||||
poster: 'images/events/2021/fall/BOT.png'
|
poster: 'images/events/2021/fall/BOT.png'
|
||||||
registerLink: https://bit.ly/csc-bot-event-signup-form
|
registerLink: https://bit.ly/csc-bot-event-signup-form
|
||||||
permaLink: /events/2021/fall/BOT/
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Kick off the fall term with CS Club’s BOT event! 🍂 Interested in attending upcoming CSC events? Want to meet others in the CS community?
|
Kick off the fall term with CS Club’s BOT event! 🍂 Interested in attending upcoming CSC events? Want to meet others in the CS community?
|
||||||
|
|
|
@ -27,13 +27,14 @@ export async function getEventTermsByYear(year: string): Promise<string[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Metadata {
|
interface Metadata {
|
||||||
slug: string;
|
// slug: string;
|
||||||
name: string;
|
name: string;
|
||||||
poster?: string;
|
poster?: string;
|
||||||
short: string;
|
short: string;
|
||||||
date: string;
|
date: string;
|
||||||
online: boolean;
|
online: boolean;
|
||||||
location: string;
|
location: string;
|
||||||
|
permaLink: string;
|
||||||
registerLink?: string;
|
registerLink?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +56,12 @@ export async function getEventBySlug(
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: await serialize(content),
|
content: await serialize(content),
|
||||||
metadata: { ...metadata, slug } as Metadata,
|
metadata: {
|
||||||
|
...metadata,
|
||||||
|
// slug,
|
||||||
|
// permaLink is based on the directory structure in /pages
|
||||||
|
permaLink: `/events/${year}/${term}/${slug}`,
|
||||||
|
} as Metadata,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,6 @@ export default function Term(props: Props) {
|
||||||
{...metadata}
|
{...metadata}
|
||||||
date={new Date(metadata.date)}
|
date={new Date(metadata.date)}
|
||||||
key={metadata.name + metadata.date.toString()}
|
key={metadata.name + metadata.date.toString()}
|
||||||
link={`/events/${props.year}/${props.term}/${metadata.slug}`}
|
|
||||||
>
|
>
|
||||||
<MDXRemote {...content} />
|
<MDXRemote {...content} />
|
||||||
</EventCard>
|
</EventCard>
|
||||||
|
|
Loading…
Reference in New Issue