mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add dynamic metadata for courses page
This commit is contained in:
parent
82eda23515
commit
c07acf5ddf
1 changed files with 16 additions and 3 deletions
|
|
@ -3,12 +3,25 @@ import React from "react";
|
|||
import Courses from "./courses";
|
||||
import { getOrgCourses } from "@services/courses/courses";
|
||||
import { Metadata } from "next";
|
||||
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'LearnHouse - Courses',
|
||||
description: 'courses',
|
||||
type MetadataProps = {
|
||||
params: { orgslug: string };
|
||||
searchParams: { [key: string]: string | string[] | undefined };
|
||||
};
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params }: MetadataProps,
|
||||
): Promise<Metadata> {
|
||||
|
||||
// Get Org context information
|
||||
const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] });
|
||||
return {
|
||||
title: org.name + " — Courses",
|
||||
description: org.description,
|
||||
};
|
||||
}
|
||||
|
||||
const CoursesPage = async (params: any) => {
|
||||
const orgslug = params.params.orgslug;
|
||||
const courses = await getOrgCourses(orgslug, { revalidate: 360, tags: ['courses'] });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue