@eventcatalog/core 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Seo from '@components/Seo.astro';
|
|
3
|
+
import { buildUrl } from '@utils/url-builder';
|
|
4
|
+
import { getEvents } from '@utils/events';
|
|
5
|
+
import { getCommands } from '@utils/commands';
|
|
6
|
+
import { getServices } from '@utils/services/services';
|
|
7
|
+
import { getDomains } from '@utils/domains/domains';
|
|
8
|
+
import type { CollectionEntry } from 'astro:content';
|
|
9
|
+
import type { CollectionTypes } from '@types';
|
|
10
|
+
|
|
11
|
+
export async function getStaticPaths() {
|
|
12
|
+
const [events, commands, services, domains] = await Promise.all([getEvents(), getCommands(), getServices(), getDomains()]);
|
|
13
|
+
|
|
14
|
+
const buildPages = (collection: CollectionEntry<CollectionTypes>[]) => {
|
|
15
|
+
return collection.map((item) => ({
|
|
16
|
+
params: {
|
|
17
|
+
type: item.collection,
|
|
18
|
+
id: item.data.id,
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
type: item.collection,
|
|
22
|
+
...item,
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = Astro.props;
|
|
31
|
+
const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
32
|
+
|
|
33
|
+
const { pathname } = Astro.url;
|
|
34
|
+
const redirectUrl = buildUrl(pathname + '/' + props.data.latestVersion);
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
<!doctype html>
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<head>
|
|
40
|
+
<meta http-equiv="refresh" content={`0; url=${redirectUrl}`} />
|
|
41
|
+
<Seo title={`EventCatalog | ${pageTitle}`} ogTitle={pageTitle} />
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<p>You are being redirected to <a href={redirectUrl}>{redirectUrl}</a></p>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|