Repository navigation
Expand file tree
/
Copy pathmeta.ts
More file actions
43 lines (35 loc) · 1.28 KB
/
Copy pathmeta.ts
File metadata and controls
43 lines (35 loc) · 1.28 KB
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
41
42
43
import { Contact } from "~/lib/provinces";
export type Meta = {
title: string;
description: string;
};
export function getProvinceMetaTitle(provinceName: string): string {
return `Informasi Faskes & Alkes untuk COVID-19 di Provinsi ${provinceName}`;
}
export function getProvinceMeta(provinceName: string): Meta {
return {
// @TODO: change this after got a better title
title: getProvinceMetaTitle(provinceName),
description: `Informasi seputar COVID-19 dan kontak fasilitas/alat kesehatan di Provinsi ${provinceName} yang dikumpulkan relawan melalui pencarian di internet atau media sosial.`,
};
}
export function getContactMetaTitle(
provinceName: string,
contact: Contact,
): string {
const providerWithSeparator = contact.penyedia
? `${contact.penyedia} - `
: "";
const location =
contact.lokasi && contact.lokasi != provinceName
? `${contact.lokasi}, ${provinceName}`
: `${provinceName}`;
return `${providerWithSeparator}${contact.keterangan} di ${location}`;
}
export function getContactMeta(provinceName: string, contact: Contact): Meta {
const title = getContactMetaTitle(provinceName, contact);
return {
title,
description: `Informasi ${title} yang dikumpulkan relawan melalui pencarian di internet atau media sosial.`,
};
}