feat: support course meta tags (#421)

* support course meta tags

* fix import
This commit is contained in:
Rotimi Best
2024-08-01 14:04:50 +01:00
committed by GitHub
parent 1755c06bf1
commit 99f236b70d
8 changed files with 173 additions and 85 deletions
+42 -1
View File
@@ -1,3 +1,4 @@
import type { MetaTagsProps } from 'svelte-meta-tags';
import { dev, browser } from '$app/environment';
import { redirect } from '@sveltejs/kit';
import { blockedSubdomain } from '$lib/utils/constants/app';
@@ -16,6 +17,7 @@ interface LoadOutput {
isOrgSite: boolean;
skipAuth: boolean;
org: CurrentOrg | null;
baseMetaTags: MetaTagsProps;
}
export const load = async ({ url, cookies }): Promise<LoadOutput> => {
@@ -23,7 +25,8 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
orgSiteName: '',
isOrgSite: false,
skipAuth: false,
org: null
org: null,
baseMetaTags: getBaseMetaTags(url)
};
// Selfhosted usecase would be here
@@ -98,6 +101,44 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
return response;
};
function getBaseMetaTags(url: URL) {
return Object.freeze({
title: 'ClassroomIO – Launch Your Online Bootcamp In Minutes',
description:
'Launch your bootcamp quickly and affordably with ClassroomIO, the customizable online teaching platform.',
canonical: new URL(url.pathname, url.origin).href,
openGraph: {
type: 'website',
url: new URL(url.pathname, url.origin).href,
locale: 'en_IE',
title: 'ClassroomIO – Launch Your Online Bootcamp In Minutes',
description:
'Launch your bootcamp quickly and affordably with ClassroomIO, the customizable online teaching platform.',
siteName: 'ClassroomIO',
images: [
{
url: 'https://classroomio.com/classroomio-opengraph-image.png',
alt: 'ClassroomIO OG Image',
width: 1920,
height: 1080,
secureUrl: 'https://classroomio.com/classroomio-opengraph-image.png',
type: 'image/jpeg'
}
]
},
twitter: {
handle: '@classroomio',
site: '@classroomio',
cardType: 'summary_large_image',
title: 'ClassroomIO – Launch Your Online Bootcamp In Minutes',
description:
'Launch your bootcamp quickly and affordably with ClassroomIO, the customizable online teaching platform.',
image: 'https://classroomio.com/classroomio-opengraph-image.png',
imageAlt: 'ClassroomIO OG Image'
}
});
}
// Define getInitialLocale function
function getInitialLocale(): string {
if (browser) {