astro-accelerator 6.0.9 → 6.0.11

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.0.9",
2
+ "version": "6.0.11",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "@astrojs/mdx": "^5.0.3",
38
38
  "@img/sharp-linux-x64": "^0.34.5",
39
- "astro": "^6.1.1",
40
- "astro-accelerator-utils": "^0.3.76",
39
+ "astro": "^6.1.5",
40
+ "astro-accelerator-utils": "^0.3.79",
41
41
  "csv": "^6.5.1",
42
42
  "hast-util-from-selector": "^3.0.1",
43
43
  "html-to-text": "^9.0.5",
@@ -47,8 +47,8 @@
47
47
  "sharp": "^0.34.5"
48
48
  },
49
49
  "devDependencies": {
50
- "@playwright/test": "^1.58.2",
51
- "cspell": "^9.7.0",
50
+ "@playwright/test": "^1.59.1",
51
+ "cspell": "^10.0.0",
52
52
  "glob": "^13.0.6",
53
53
  "linkinator": "^7.6.1"
54
54
  },
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import { getCollection } from "astro:content";
2
3
  import type { Frontmatter } from "astro-accelerator-utils/types/Frontmatter";
3
4
  import { SITE } from "@config";
4
5
  import { Lang } from "@util/Languages";
@@ -14,8 +15,31 @@ const lang = frontmatter.lang ?? SITE.default.lang;
14
15
 
15
16
  // Language
16
17
  const _ = Lang(lang);
18
+
19
+ const allEvents = await getCollection("events");
20
+ const years = [
21
+ ...new Set(allEvents.map((event) => event.data.startDate.getFullYear())),
22
+ ].sort((a, b) => b - a);
23
+
24
+ const isCurrent = Astro.url.pathname.endsWith("/events/") || Astro.url.pathname.endsWith("/events");
17
25
  ---
18
26
 
19
27
  <EventsLayout frontmatter={frontmatter} headings={headings}>
28
+ <nav class="post-taxonomy">
29
+ <ul>
30
+ <li>
31
+ <a href="/events/" aria-current={isCurrent ? "page" : undefined}
32
+ >Current</a
33
+ >
34
+ </li>
35
+ {
36
+ years.map((y) => (
37
+ <li>
38
+ <a href={`/events/${y}/`}>{y}</a>
39
+ </li>
40
+ ))
41
+ }
42
+ </ul>
43
+ </nav>
20
44
  <slot />
21
45
  </EventsLayout>
@@ -0,0 +1,91 @@
1
+ ---
2
+ import { getCollection } from "astro:content";
3
+ import { SITE } from "@config";
4
+ import { Lang } from "@util/Languages";
5
+ import DefaultLayout from "src/layouts/Default.astro";
6
+ import TimelineEvent from "@components/TimelineEvent.astro";
7
+
8
+ export async function getStaticPaths() {
9
+ const allEvents = await getCollection("events");
10
+ const years = [
11
+ ...new Set(
12
+ allEvents.map((event) => event.data.startDate.getFullYear()),
13
+ ),
14
+ ];
15
+
16
+ return years.map((year) => ({
17
+ params: { year: year.toString() },
18
+ props: { year },
19
+ }));
20
+ }
21
+
22
+ const { year } = Astro.props;
23
+ const lang = SITE.default.lang;
24
+ const _ = Lang(lang);
25
+
26
+ const allEvents = await getCollection("events");
27
+ const years = [
28
+ ...new Set(allEvents.map((event) => event.data.startDate.getFullYear())),
29
+ ].sort((a, b) => b - a);
30
+
31
+ const events = allEvents.filter(({ data }) => {
32
+ return data.startDate.getFullYear() === year;
33
+ });
34
+
35
+ const sortedEvents = events.sort(
36
+ (a, b) => b.data.startDate.getTime() - a.data.startDate.getTime(),
37
+ );
38
+
39
+ const frontmatter = {
40
+ title: `Events in ${year}`,
41
+ description: `An archive of events from ${year}.`,
42
+ };
43
+
44
+ const breadcrumbs = [
45
+ {
46
+ url: `/events/${year}/`,
47
+ title: year.toString(),
48
+ ariaCurrent: "page",
49
+ },
50
+ ];
51
+ ---
52
+
53
+ <DefaultLayout
54
+ frontmatter={frontmatter as any}
55
+ headings={[]}
56
+ breadcrumbs={breadcrumbs}>
57
+ <nav class="post-taxonomy">
58
+ <ul>
59
+ <li><a href="/events/">Current</a></li>
60
+ {
61
+ years.map((y) => (
62
+ <li>
63
+ <a
64
+ href={`/events/${y}/`}
65
+ aria-current={y === year ? "page" : undefined}
66
+ >{y}</a
67
+ >
68
+ </li>
69
+ ))
70
+ }
71
+ </ul>
72
+ </nav>
73
+
74
+ <h2>{year}</h2>
75
+ <div class="timeline" data-timeline>
76
+ {
77
+ sortedEvents.map((event) => (
78
+ <TimelineEvent
79
+ date={event.data.startDate as any}
80
+ endDate={event.data.endDate as any}
81
+ title={event.data.title}
82
+ location={event.data.location}
83
+ description={event.data.description}
84
+ linkHref={event.data.linkHref}
85
+ linkText={event.data.linkText}
86
+ detailsHref={"/events/" + event.id + "/"}
87
+ />
88
+ ))
89
+ }
90
+ </div>
91
+ </DefaultLayout>
@@ -0,0 +1,44 @@
1
+ ---
2
+ import { getCollection } from "astro:content";
3
+ import { SITE } from "@config";
4
+ import DefaultLayout from "src/layouts/Default.astro";
5
+
6
+ const allEvents = await getCollection("events");
7
+ const years = [
8
+ ...new Set(allEvents.map((event) => event.data.startDate.getFullYear())),
9
+ ].sort((a, b) => b - a);
10
+
11
+ const frontmatter = {
12
+ title: "Events Archive",
13
+ description: "An archive of my past online and in-person events.",
14
+ };
15
+
16
+ const breadcrumbs = [
17
+ {
18
+ url: "/events/archive/",
19
+ title: "Archive",
20
+ ariaCurrent: "page",
21
+ },
22
+ ];
23
+ ---
24
+
25
+ <DefaultLayout
26
+ frontmatter={frontmatter as any}
27
+ headings={[]}
28
+ breadcrumbs={breadcrumbs}>
29
+ <p>
30
+ This page captures past events, grouped by year. You can view <a
31
+ href="/events/">my current event list here</a
32
+ >.
33
+ </p>
34
+
35
+ <ul>
36
+ {
37
+ years.map((year) => (
38
+ <li>
39
+ <a href={`/events/${year}/`}>{year}</a>
40
+ </li>
41
+ ))
42
+ }
43
+ </ul>
44
+ </DefaultLayout>