Skip to content

Commit

Permalink
Added metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
erland-syafiq committed Jun 5, 2024
1 parent be9c36d commit 38b1726
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 9 deletions.
5 changes: 5 additions & 0 deletions site/app/about/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import UserCard from '../components/UserCard.jsx';
import './AboutUs.css';
import fetchStaticJSON from '../utils/fetchStaticJSON.js';

export const metadata = {
title: "About Us",
description: "Meet the VTMUNC Secretariat: dedicated leaders organizing an inspiring conference. Learn about their roles, backgrounds, and commitment to global diplomacy."
}

async function AboutUs() {
const secretariat = await fetchStaticJSON("/app/data/secretariat.json");

Expand Down
26 changes: 24 additions & 2 deletions site/app/committees/[slug]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import fetchStaticJSON from '@/app/utils/fetchStaticJSON';
import UserCard from '@/app/components/UserCard';
import './CommitteeDetails.css';
import FormattedParagraph from '@/app/components/FormattedParagraph';
import { notFound } from 'next/navigation';


function findCommittee(committeeGroups, queryId) {
for (const group of committeeGroups) {
Expand All @@ -12,10 +14,27 @@ function findCommittee(committeeGroups, queryId) {
}
}
}

return null;
}

export async function generateMetadata({ params }) {
const committeeGroups = await fetchStaticJSON("/app/data/committees.json");
const id = params.slug;
const committee = findCommittee(committeeGroups, id);

if (!committee) {
notFound();
}

const title = committee.committee_name.substring(0, 60); // Ensure title is not too long
const description = committee.committee_bio.substring(0, 160); // Ensure description is not too long

return {
title,
description,
};
}

export default async function CommitteeDetailsPage({params}) {
const committeeGroups = await fetchStaticJSON("/app/data/committees.json");
Expand All @@ -24,7 +43,10 @@ export default async function CommitteeDetailsPage({params}) {
const committee = findCommittee(committeeGroups, id);

if (!committee) {
return NextResponse.rewrite(new URL('/404', request.url));
return {
title: "Page not found",
description: "Page you're looking for doesn't exist. ."
}
}

const isOneChair = committee.co_chair_name == null;
Expand Down
6 changes: 5 additions & 1 deletion site/app/committees/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import Committee from '../components/Commitee';
import './Committees.css';
import fetchStaticJSON from '../utils/fetchStaticJSON';

export const metadata = {
title: "Committees",
description: "Explore the heart of VTMUNC on our Committees page! Discover detailed information about each committee, including topics of discussion, background guides, and key objectives. Our committees cover a diverse range of global issues, providing a platform for delegates to engage in meaningful debates and develop solutions. Whether you're interested in international security, economic development, or human rights, the VTMUNC Committees page offers everything you need to prepare for and excel in your sessions. Enhance your Model United Nations experience by learning about the committees and their critical roles at VTMUNC. Visit now to get started! "
}

async function Committees() {
const committeeGroups = await fetchStaticJSON("/app/data/committees.json");


return (
<main className="container">
Expand Down
2 changes: 1 addition & 1 deletion site/app/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Footer() {
<div className="footerText col-12 col-md-8 pb-3">
<div className="logoTitle d-flex align-items-center">
<img src="/Images/Logo.png" />
<h4>VTMUNC 2024</h4>
<h4>VTMUNC 2025</h4>
</div>
<p>
Virginia Tech, Blacksburg, VA 24061 <br/>
Expand Down
8 changes: 4 additions & 4 deletions site/app/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ function Navbar() {
const navbarStyle = isHomePage ? 'navbar-transparent' : '';

return (
<nav className={`${navbarStyle} navbar navbar-expand-sm navbar-toggleable-sm navbar-light box-shadow`}>
<nav className={`${navbarStyle} navbar navbar-expand-md navbar-toggleable-md navbar-light box-shadow`}>
<div className="container-fluid">
<Link href="/"><img src="/Images/Logo.png" className="navbar-logo"/></Link>
<Link className="nav-link" href="/">VTMUNC</Link>
<button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>
<div className="navbar-collapse collapse d-sm-inline-flex justify-content-end">
<div className="navbar-collapse collapse d-md-inline-flex justify-content-end">
<Link className="nav-link" href="/"> Home </Link>
<Link className="nav-link" href="/about"> About Us </Link>
<Link className="nav-link" href="/committees">Committees </Link>
<Link className="nav-link" href="/resources">Resources </Link>
<Link className="nav-link" href="/sponsors"> Sponsors </Link>
{/* <Link className="nav-link" href="/resources">Resources </Link>
<Link className="nav-link" href="/sponsors"> Sponsors </Link> */}
<Link className="nav-link" href="/register"> Register </Link>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion site/app/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Script from "next/script";

export const metadata = {
title: "VTMUNC",
description: "The premier model united nations conference",
description: "Discover VTMUNC: Engage in dynamic debates, connect with global delegates. Over 300 participants in 2024. Join us and be part of international diplomacy",
};

export default function RootLayout({ children }) {
Expand Down
6 changes: 6 additions & 0 deletions site/app/login/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import React, { useState } from 'react';
import './LoginPage.css';
import { isValidEmail } from '../utils/validation';

export const metadata = {
title: "Staff login",
description: "Login page for staff.",
noindex: true
}

export default function Login () {
const [formData, setFormData] = useState({ email: '', password: '' });
const [rememberMe, setRememberMe] = useState(false);
Expand Down
5 changes: 5 additions & 0 deletions site/app/register/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import React from 'react';
import RegisterForm from './RegisterForm';
import './Register.css';

export const metadata = {
title: "Register",
description: "Register for VTMUNC to access committee info, schedules, and benefits. Join dynamic debates, develop diplomacy skills, and connect with global delegates"
}

export default function RegisterPage() {
return (
<main className="container registerPage">
Expand Down

0 comments on commit 38b1726

Please sign in to comment.