-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.astro
More file actions
64 lines (59 loc) · 1.87 KB
/
Copy pathindex.astro
File metadata and controls
64 lines (59 loc) · 1.87 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
import PageHeader from '@blocks/PageHeader/PageHeader.astro';
import { PublicationCard } from '@blocks/PublicationCard';
import PublicationList from '@blocks/PublicationList/PublicationList.astro';
import { Button } from '@components/Button';
import { Column, Grid } from '@components/Grid';
import PreviewModeSubscription from '@components/PreviewMode/PreviewModeSubscription.astro';
import Layout from '@layouts/Default.astro';
import { setCacheControl } from '@lib/cache-control';
import { datocmsRequest } from '@lib/datocms';
import { defaultLocale, t } from '@lib/i18n';
import type { PublicationsPageQuery } from '@lib/types/datocms';
import query from './_index.query.graphql';
setCacheControl(Astro.response, 0, 10);
const { locale = defaultLocale } = Astro.params;
const { page, highlightedPublications } =
await datocmsRequest<PublicationsPageQuery>({
query,
variables: { locale },
});
if (!page) {
return new Response(null, { status: 404 });
}
---
<Layout pageUrls={[]} seoMetaTags={page._seoMetaTags}>
<PreviewModeSubscription query={query} variables={{ locale }} />
<PageHeader title={page.header.title} subtitle={page.header.subtitle}>
<Fragment slot="header">
<Button
as="a"
href="../"
className="back-button"
level="tertiary"
icon="arrow-left"
iconPosition="left"
>
{t('back_to_home')}
</Button>
</Fragment>
</PageHeader>
<Grid as="section" border>
<h2 class="a11y-sr-only">{page.highlightedPublicationsTitle}</h2>
{
highlightedPublications.map((publication) => (
<Column
key={publication.id}
span={{
mobile: 12,
tablet: 6,
desktop: 4,
}}
>
<PublicationCard publication={publication} priority={true} />
</Column>
))
}
</Grid>
<PublicationList />
</Layout>