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 Courses from "./courses";
|
||||||
import { getOrgCourses } from "@services/courses/courses";
|
import { getOrgCourses } from "@services/courses/courses";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
|
import { getOrganizationContextInfo } from "@services/organizations/orgs";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
type MetadataProps = {
|
||||||
title: 'LearnHouse - Courses',
|
params: { orgslug: string };
|
||||||
description: 'courses',
|
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 CoursesPage = async (params: any) => {
|
||||||
const orgslug = params.params.orgslug;
|
const orgslug = params.params.orgslug;
|
||||||
const courses = await getOrgCourses(orgslug, { revalidate: 360, tags: ['courses'] });
|
const courses = await getOrgCourses(orgslug, { revalidate: 360, tags: ['courses'] });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue