summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/web/views/channel.tsx
blob: 7d8123ea85d9cedcf5c50a4a4da4dd3ed836087d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import type { Packed } from '@/misc/json-schema.js';
import type { CommonProps } from '@/server/web/views/_.js';
import { Layout } from '@/server/web/views/base.js';

export function ChannelPage(props: CommonProps<{
	channel: Packed<'Channel'>;
}>) {

	function ogBlock() {
		return (
			<>
				<meta property="og:type" content="website" />
				<meta property="og:title" content={props.channel.name} />
				{props.channel.description != null ? <meta property="og:description" content={props.channel.description} /> : null}
				<meta property="og:url" content={`${props.config.url}/channels/${props.channel.id}`} />
				{props.channel.bannerUrl ? (
					<>
						<meta property="og:image" content={props.channel.bannerUrl} />
						<meta property="twitter:card" content="summary" />
					</>
				) : null}
			</>
		);
	}

	return (
		<Layout
			{...props}
			title={`${props.channel.name} | ${props.instanceName}`}
			desc={props.channel.description ?? undefined}
			ogSlot={ogBlock()}
		>
		</Layout>
	);
}