Skip to content

Commit

Permalink
Better page metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmx committed May 14, 2024
1 parent 057bcc5 commit 5d91d57
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ import Spine from './Spine';
import Schedule from './Schedule';
import ScheduleInfo from './ScheduleInfo';
import Footer from './Footer';
import { Metadata } from 'next';

const API_URL = process.env.API_URL || 'http://localhost:5050';
const QR_URL = process.env.QR_URL || 'https://qr.carrismetropolitana.pt/horarios';

export async function generateMetadata({ params }:{params:{line_id:string, stop_id:string, direction_id:string}}): Promise<Metadata> {
return {
title: `Horário ${params.line_id} - #${params.stop_id}`,
description: `Horário ${params.line_id}/${params.direction_id} - #${params.stop_id}`,
};
}

export default async function Page({ params }:{params:{line_id:string, stop_id:string, direction_id:string}}) {
const timetableRes = await fetch(`${API_URL}/timetables/${params.line_id}/${params.direction_id}/${params.stop_id}`);
const timetable: Timetable = await timetableRes.json();
Expand Down

0 comments on commit 5d91d57

Please sign in to comment.