-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDynamicAwsServices.astro
More file actions
38 lines (32 loc) · 981 Bytes
/
DynamicAwsServices.astro
File metadata and controls
38 lines (32 loc) · 981 Bytes
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
---
import { getCollection } from 'astro:content';
import { ServiceBox } from './ServiceBox.tsx';
const allServices = await getCollection('docs', ({ id }) => {
return id.startsWith('aws/services/') && !id.includes('/index');
});
const sortedServices = allServices.sort((a, b) => {
const titleA = a.data.title || a.data.linkTitle || '';
const titleB = b.data.title || b.data.linkTitle || '';
return titleA.localeCompare(titleB);
});
const serviceData = sortedServices.map(service => {
const title = service.data.title || service.data.linkTitle || 'Unknown Service';
const description = service.data.description || `Implementation details for ${title} API`;
const href = `/${service.id}`;
return {
title,
description,
href
};
});
---
<div class="service-grid">
{serviceData.map(service => (
<ServiceBox
title={service.title}
description={service.description}
href={service.href}
client:load
/>
))}
</div>