File tree Expand file tree Collapse file tree 2 files changed +40
-602
lines changed
Expand file tree Collapse file tree 2 files changed +40
-602
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ import { getCollection } from ' astro:content' ;
3+ import { ServiceBox } from ' ./ServiceBox.tsx' ;
4+
5+ const allServices = await getCollection (' docs' , ({ id }) => {
6+ return id .startsWith (' aws/services/' ) && ! id .includes (' /index' );
7+ });
8+
9+ const sortedServices = allServices .sort ((a , b ) => {
10+ const titleA = a .data .title || a .data .linkTitle || ' ' ;
11+ const titleB = b .data .title || b .data .linkTitle || ' ' ;
12+ return titleA .localeCompare (titleB );
13+ });
14+
15+ const serviceData = sortedServices .map (service => {
16+ const title = service .data .title || service .data .linkTitle || ' Unknown Service' ;
17+ const description = service .data .description || ` Implementation details for ${title } API ` ;
18+
19+ const href = ` /${service .id } ` ;
20+
21+ return {
22+ title ,
23+ description ,
24+ href
25+ };
26+ });
27+ ---
28+
29+ <div class =" service-grid" >
30+ { serviceData .map (service => (
31+ <ServiceBox
32+ title = { service .title }
33+ description = { service .description }
34+ href = { service .href }
35+ client :load
36+ />
37+ ))}
38+ </div >
You can’t perform that action at this time.
0 commit comments