mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init metadata for homepage
This commit is contained in:
parent
bb0f9166f9
commit
86e4ec64b5
2 changed files with 21 additions and 9 deletions
|
|
@ -11,7 +11,7 @@ export const metadata: Metadata = {
|
|||
|
||||
const CoursesPage = async (params: any) => {
|
||||
const orgslug = params.params.orgslug;
|
||||
const courses = await getOrgCourses(orgslug);
|
||||
const courses = await getOrgCourses(orgslug, { revalidate: 360 });
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export const dynamic = 'force-dynamic';
|
||||
|
||||
import { Metadata, ResolvingMetadata } from 'next';
|
||||
import { Menu } from "@components/UI/Elements/Menu";
|
||||
import { getBackendUrl, getUriWithOrg } from "@services/config/config";
|
||||
import { getOrgCourses } from "@services/courses/courses";
|
||||
|
|
@ -10,13 +10,28 @@ import Image from "next/image";
|
|||
import { log } from "console";
|
||||
import AuthProvider from "@components/Security/AuthProvider";
|
||||
import { getOrgCollections } from "@services/courses/collections";
|
||||
import { getOrganizationContextInfo } from '@services/organizations/orgs';
|
||||
|
||||
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 });
|
||||
return {
|
||||
title: org.name + " — Home",
|
||||
description: org.description,
|
||||
};
|
||||
}
|
||||
|
||||
const OrgHomePage = async (params: any) => {
|
||||
const orgslug = params.params.orgslug;
|
||||
// timeout to simulate a slow connection
|
||||
// await new Promise((resolve) => setTimeout(resolve, 12000));
|
||||
|
||||
const courses = await getOrgCourses(orgslug);
|
||||
const courses = await getOrgCourses(orgslug, { revalidate: 360 });
|
||||
const collections = await getOrgCollections();
|
||||
|
||||
// function to remove "course_" from the course_id
|
||||
|
|
@ -26,9 +41,6 @@ const OrgHomePage = async (params: any) => {
|
|||
|
||||
return (
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
<div className="max-w-7xl mx-auto px-4 py-10">
|
||||
{/* Collections */}
|
||||
<Title title="Collections" type="col" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue