astro-theme-popular 0.14.2 → 0.15.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-theme-popular",
3
- "version": "0.14.2",
3
+ "version": "0.15.0",
4
4
  "description": "Popular: a warm, community-first Astro theme for meetups, clubs and fan communities. Ships as an Astro integration.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/schemas.ts CHANGED
@@ -37,11 +37,18 @@ const blog = defineCollection({
37
37
  }),
38
38
  });
39
39
 
40
+ /* An optional calendar day. A bare key or an empty string reads as unset, as
41
+ it does on the Hugo side; anything else must be a date. */
42
+ const optionalDay = z.preprocess((v) => (v === '' ? undefined : v), z.coerce.date().nullish());
43
+
40
44
  const events = defineCollection({
41
45
  loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/events' }),
42
46
  schema: z.object({
43
47
  title: z.string(),
44
- date: z.coerce.date(), // the event's start time; upcoming vs past is decided by this
48
+ date: z.coerce.date(), // the event's start day; upcoming vs past is decided by its last day
49
+ // Last day of a multi-day event (inclusive); omit for one-day events.
50
+ // A bare `endDate:` or an empty string left in a template reads as unset.
51
+ endDate: optionalDay,
45
52
  draft: z.boolean().default(false), // drafts are excluded from builds, matching Hugo
46
53
  description: z.string().optional(),
47
54
  image: z.string().optional(),
@@ -71,6 +78,8 @@ const events = defineCollection({
71
78
  talks: z.array(z.object({
72
79
  title: z.string(),
73
80
  speaker: z.string().optional(), // speaker-collection slug, same resolution as `speakers`
81
+ date: optionalDay, // the day of a multi-day event this talk is on
82
+ time: z.string().optional(), // free text, e.g. "9:30 AM"
74
83
  recording: z.string().optional(),
75
84
  slides: z.string().optional(),
76
85
  })).optional(),
@@ -4,6 +4,7 @@ import type { CollectionEntry } from 'astro:content';
4
4
  import { safeCollection } from '../lib/collections';
5
5
  import { withBase } from '../lib/url';
6
6
  import { eventHasRecording } from '../lib/talks';
7
+ import { formatEventDates, formatEventRowDay } from '../lib/eventdates';
7
8
 
8
9
  interface Props { event: CollectionEntry<'events'> }
9
10
  const { event } = Astro.props;
@@ -30,8 +31,9 @@ const names = d.speakers.map((slug) => {
30
31
  }).filter(Boolean);
31
32
  const speakerLine = names.length ? names.join(', ') : d.speaker;
32
33
 
33
- const dow = d.date.toLocaleDateString(SITE.locale, { weekday: 'short' });
34
- const day = d.date.toLocaleDateString(SITE.locale, { month: 'short', day: 'numeric' });
34
+ /* A multi-day event shows its span: "Sat – Sun" over "Jun 6 – 7". */
35
+ const dow = formatEventDates(d, SITE.locale, { weekday: 'short' });
36
+ const day = formatEventRowDay(d, SITE.locale);
35
37
  ---
36
38
 
37
39
  <div class="g-event">
@@ -33,7 +33,12 @@ interface Props {
33
33
  }
34
34
  const { title, description, image, article, imageAlt, noindex } = Astro.props;
35
35
  const ogLocale = SITE.locale.replace('-', '_');
36
- const pageTitle = title ? `${title} · ${SITE.title}` : `${SITE.title}, ${SITE.tagline}`;
36
+ /* The home title joins whichever of title and tagline are set, so a missing
37
+ one never leaves a stray separator (", Tagline" or "Title, undefined").
38
+ The Hugo twin does the same in partials/head.html. */
39
+ const pageTitle = title
40
+ ? [title, SITE.title].filter(Boolean).join(' · ')
41
+ : [SITE.title, SITE.tagline].filter(Boolean).join(', ');
37
42
  const desc = description ?? SITE.description;
38
43
  const ogImage = image ?? SITE.ogImage;
39
44
  /* Astro.url.pathname already carries the base; Astro.site does not, hence
@@ -96,9 +101,12 @@ const brandCss = `html:root{${vars.join(';')}}`;
96
101
  <meta name="generator" content={Astro.generator} />
97
102
  <title>{pageTitle}</title>
98
103
  <meta name="description" content={desc} />
99
- <meta property="og:site_name" content={SITE.title} />
104
+ {/* With no site title, og:site_name is left out rather than written
105
+ empty, and the home og:title falls back to the tagline, the same way
106
+ the home <title> does. The Hugo twin does the same in seo.html. */}
107
+ {SITE.title && <meta property="og:site_name" content={SITE.title} />}
100
108
  <meta property="og:locale" content={ogLocale} />
101
- <meta property="og:title" content={title ?? SITE.title} />
109
+ <meta property="og:title" content={title ?? (SITE.title || SITE.tagline)} />
102
110
  <meta property="og:description" content={desc} />
103
111
  <meta property="og:url" content={canonical} />
104
112
  <link rel="canonical" href={canonical} />
@@ -0,0 +1,92 @@
1
+ /** Event date helpers, mirroring partials/event-dates.html,
2
+ * event-date-text.html and events-split.html on the Hugo side. An event runs
3
+ * from `date` to the optional `endDate` (both calendar days, inclusive).
4
+ * Everything here reads the UTC calendar day, the same day the iCalendar
5
+ * feed and the Event JSON-LD use, so a plain `date: 2026-06-06` is June 6
6
+ * wherever the site is built. */
7
+
8
+ export interface EventSpan { date: Date; endDate?: Date | null }
9
+
10
+ const DAY_MS = 86400000;
11
+ const dayStart = (d: Date) => Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
12
+
13
+ /** One calendar day as text, in the site locale. */
14
+ export function formatEventDay(d: Date, locale: string, options: Intl.DateTimeFormatOptions): string {
15
+ return new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).format(d);
16
+ }
17
+
18
+ /** YYYY-MM-DD of the UTC calendar day. */
19
+ export function dayKey(d: Date): string {
20
+ return d.toISOString().slice(0, 10);
21
+ }
22
+
23
+ /** The event's last day: `endDate` when it is on a later day than `date`,
24
+ * else `date`. An `endDate` before `date` is ignored. */
25
+ export function eventLastDay(e: EventSpan): Date {
26
+ return e.endDate && dayStart(e.endDate) > dayStart(e.date) ? e.endDate : e.date;
27
+ }
28
+
29
+ export function isMultiDay(e: EventSpan): boolean {
30
+ return dayStart(eventLastDay(e)) > dayStart(e.date);
31
+ }
32
+
33
+ /** Every calendar day of the event, as UTC midnights. */
34
+ export function eventDays(e: EventSpan): Date[] {
35
+ const days: Date[] = [];
36
+ for (let t = dayStart(e.date); t <= dayStart(eventLastDay(e)); t += DAY_MS) days.push(new Date(t));
37
+ return days;
38
+ }
39
+
40
+ /** Upcoming or past. A one-day event is past once its `date` has passed. A
41
+ * multi-day event stays upcoming through the end of its last day, so it does
42
+ * not drop to "past" partway through the weekend. */
43
+ export function isUpcomingEvent(e: EventSpan, now: Date | number): boolean {
44
+ return isMultiDay(e) ? dayStart(eventLastDay(e)) + DAY_MS > +now : +e.date >= +now;
45
+ }
46
+
47
+ /** "Saturday, Jun 6, 2026", or "Saturday, Jun 6 – Sunday, Jun 7, 2026" for a
48
+ * multi-day event (Intl writes a shared month or year once). When the
49
+ * options carry no year, as in the event row, a span across New Year stays
50
+ * "Dec 31 – Jan 2" instead of gaining both years, matching Hugo. */
51
+ export function formatEventDates(e: EventSpan, locale: string, options: Intl.DateTimeFormatOptions): string {
52
+ if (!isMultiDay(e)) return formatEventDay(e.date, locale, options);
53
+ const last = eventLastDay(e);
54
+ if (!options.year && e.date.getUTCFullYear() !== last.getUTCFullYear()) {
55
+ return `${formatEventDay(e.date, locale, options)} – ${formatEventDay(last, locale, options)}`;
56
+ }
57
+ return new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).formatRange(e.date, last);
58
+ }
59
+
60
+ /* The same text with its spaces made non-breaking (a thin space becomes the
61
+ narrow no-break space). A word joiner goes with each one: a line may
62
+ otherwise still break between an en dash and a no-break space. */
63
+ const noBreak = (s: string) => s.replace(/\u2009/g, '\u2060\u202f').replace(/ /g, '\u2060\u00a0');
64
+
65
+ /** The event row's day, "Jun 6", or "Jun 6 – 7" / "Apr 30 – May 2" for a
66
+ * multi-day event. The row's date box is narrow, so the span carries
67
+ * no-break spaces that keep the end day from landing alone on a line: a
68
+ * shared month may sit over "16 – 17", and "Apr 30 –" over "May 2". Each
69
+ * line is then one unbreakable run, so a long localized month can reach
70
+ * into the box's padding. */
71
+ export function formatEventRowDay(e: EventSpan, locale: string): string {
72
+ const options: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric' };
73
+ if (!isMultiDay(e)) return formatEventDay(e.date, locale, options);
74
+ const last = eventLastDay(e);
75
+ if (e.date.getUTCFullYear() !== last.getUTCFullYear()) {
76
+ return `${noBreak(formatEventDay(e.date, locale, options))}\u2060\u00a0– ${noBreak(formatEventDay(last, locale, options))}`;
77
+ }
78
+ const parts = new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).formatRangeToParts(e.date, last);
79
+ const endHasMonth = parts.some((p) => p.source === 'endRange' && p.type === 'month');
80
+ return parts.map((p, i) => {
81
+ if (p.source !== 'shared') return noBreak(p.value);
82
+ const separator = parts[i - 1]?.source === 'startRange' && parts[i + 1]?.source === 'endRange';
83
+ if (!separator) return p.value;
84
+ /* The separator is " – " in English, but a bare "–" in en-CA and ". – "
85
+ in Hungarian, so an edge with no space to convert gets a word joiner.
86
+ Across months the space after the dash stays as the one place to wrap. */
87
+ const [, lead, trail] = p.value.match(/^(.*?)(\s*)$/s)!;
88
+ const head = (/^\s/.test(lead) ? '' : '\u2060') + noBreak(lead);
89
+ if (endHasMonth) return head + trail;
90
+ return head + (trail ? noBreak(trail) : '\u2060');
91
+ }).join('');
92
+ }
@@ -2,6 +2,8 @@
2
2
  * The time-parsing contract and its vectors live in PARITY.md; the Hugo and
3
3
  * Astro implementations must agree on every vector. */
4
4
 
5
+ import { dayKey, eventLastDay, isMultiDay } from './eventdates';
6
+
5
7
  /** Parse an event `time` free-text field to event-local "HH:MM", or null.
6
8
  * Leading token only: "6:00 PM · doors 5:30" -> "18:00"; "doors 5:30" -> null. */
7
9
  export function parseEventTime(raw: string | undefined): string | null {
@@ -43,6 +45,7 @@ export function jsonld(obj: Record<string, any>): string {
43
45
  export interface EventLdInput {
44
46
  title: string;
45
47
  date: Date;
48
+ endDate?: Date | null;
46
49
  time?: string;
47
50
  description?: string;
48
51
  cancelled?: boolean;
@@ -72,6 +75,8 @@ export function buildEventLd(i: EventLdInput): Record<string, any> {
72
75
  : 'https://schema.org/OfflineEventAttendanceMode',
73
76
  organizer: { '@type': 'Organization', name: i.siteTitle, url: i.siteUrl },
74
77
  };
78
+ /* Multi-day: endDate is the last calendar day, date-only. */
79
+ if (isMultiDay(i)) ld.endDate = dayKey(eventLastDay(i));
75
80
  const desc = (i.description ?? '').trim();
76
81
  if (desc) ld.description = desc.length > 300 ? desc.slice(0, 299) + '…' : desc;
77
82
  if (i.online) {
package/src/lib/ical.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * template. DTSTART reuses parseEventTime (lib/eventld) so the feed and the
3
3
  * Event JSON-LD agree. Folding is byte-accurate at 75 octets. */
4
4
  import { parseEventTime } from './eventld';
5
+ import { eventLastDay, isMultiDay } from './eventdates';
5
6
 
6
7
  const pad = (n: number) => String(n).padStart(2, '0');
7
8
  const enc = new TextEncoder();
@@ -42,6 +43,7 @@ export function fold(line: string): string {
42
43
  export interface IcsEvent {
43
44
  title: string;
44
45
  date: Date;
46
+ endDate?: Date | null; // last day of a multi-day event (inclusive)
45
47
  time?: string;
46
48
  description?: string;
47
49
  checkin?: string;
@@ -70,7 +72,15 @@ export function buildIcs(
70
72
  L.push(fold(`UID:${e.permalink}`));
71
73
  L.push(fold(`DTSTAMP:${opts.dtstamp}`));
72
74
  const hm = parseEventTime(e.time);
73
- if (hm) {
75
+ if (isMultiDay(e)) {
76
+ /* Multi-day: an all-day span. DTEND is exclusive, so the day after the
77
+ last day. The `time` text is not applied: it describes each day, not
78
+ one continuous block from the first morning to the last evening. */
79
+ const last = eventLastDay(e);
80
+ const after = new Date(Date.UTC(last.getUTCFullYear(), last.getUTCMonth(), last.getUTCDate() + 1));
81
+ L.push(fold(`DTSTART;VALUE=DATE:${ymd(e.date)}`));
82
+ L.push(fold(`DTEND;VALUE=DATE:${ymd(after)}`));
83
+ } else if (hm) {
74
84
  const [h, m] = hm.split(':').map(Number);
75
85
  L.push(fold(`DTSTART:${ymd(e.date)}T${pad(h)}${pad(m)}00`));
76
86
  const total = h * 60 + m + opts.durationMinutes;
package/src/lib/talks.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * recording/slides. When talks[] is present it wins; event-level
5
5
  * recording/slides are ignored (not merged), matching the Hugo side. */
6
6
  import type { CollectionEntry } from 'astro:content';
7
+ import { dayKey, isMultiDay } from './eventdates';
7
8
 
8
9
  type EventData = CollectionEntry<'events'>['data'];
9
10
 
@@ -13,6 +14,8 @@ export interface Talk {
13
14
  speakerName?: string; // display name (profile title, or the free-text speaker)
14
15
  recording?: string;
15
16
  slides?: string;
17
+ day?: Date | null; // the day of a multi-day event this talk is on
18
+ time?: string;
16
19
  }
17
20
 
18
21
  export interface TalkRow extends Talk {
@@ -45,7 +48,7 @@ export function eventTalks(
45
48
  return found?.data.title;
46
49
  };
47
50
  const anyD = d as EventData & {
48
- talks?: Talk[]; recording?: string; slides?: string;
51
+ talks?: (Talk & { speaker?: string; date?: Date | null })[]; recording?: string; slides?: string;
49
52
  };
50
53
  if (anyD.talks?.length) {
51
54
  return anyD.talks.map((t) => ({
@@ -54,6 +57,8 @@ export function eventTalks(
54
57
  speakerName: nameOf(t.speaker),
55
58
  recording: t.recording,
56
59
  slides: t.slides,
60
+ day: t.date,
61
+ time: t.time,
57
62
  }));
58
63
  }
59
64
  if (anyD.recording || anyD.slides) {
@@ -71,16 +76,22 @@ export function eventTalks(
71
76
  }
72
77
 
73
78
  /** Every talk across the given events, newest event first, for the /talks/
74
- * index. Each row carries its parent event's link, date, and tags (the tags
75
- * drive the shared blog-filter.js tag filter). */
79
+ * index. Within an event the talks follow the event page: on a multi-day
80
+ * event those with no day first, then by day, written order within a day;
81
+ * on any other event the order they were written in. Each row carries its
82
+ * parent event's link, date, and tags (the tags drive the shared
83
+ * blog-filter.js tag filter). */
76
84
  export function collectTalks(
77
85
  events: CollectionEntry<'events'>[],
78
86
  speakers: CollectionEntry<'speakers'>[],
79
87
  ): TalkRow[] {
80
88
  const rows: TalkRow[] = [];
81
89
  for (const e of [...events].sort((a, b) => +b.data.date - +a.data.date)) {
82
- for (const t of eventTalks(e.data, speakers, e.id)) {
83
- rows.push({ ...t, eventId: e.id, eventTitle: e.data.title, date: e.data.date, tags: e.data.tags });
90
+ const order = (t: Talk) => (t.day ? dayKey(t.day) : '');
91
+ const talks = eventTalks(e.data, speakers, e.id);
92
+ if (isMultiDay(e.data)) talks.sort((a, b) => order(a).localeCompare(order(b)));
93
+ for (const t of talks) {
94
+ rows.push({ ...t, eventId: e.id, eventTitle: e.data.title, date: t.day ?? e.data.date, tags: e.data.tags });
84
95
  }
85
96
  }
86
97
  return rows;
@@ -6,6 +6,7 @@ import EventRow from 'popular:component/EventRow';
6
6
  import Pagination from '../../components/Pagination.astro';
7
7
  import CalendarSubscribe from '../../components/CalendarSubscribe.astro';
8
8
  import EventsEmpty from '../../components/EventsEmpty.astro';
9
+ import { isUpcomingEvent } from '../../lib/eventdates';
9
10
  import { SECTIONS, STRINGS, PAGINATION } from 'popular:config';
10
11
 
11
12
  /* One route serves /events/ and /events/page/N/, matching the Hugo theme's
@@ -14,8 +15,8 @@ import { SECTIONS, STRINGS, PAGINATION } from 'popular:config';
14
15
  export async function getStaticPaths() {
15
16
  const now = new Date();
16
17
  const all = (await safeCollection('events')).filter((e) => !e.data.draft);
17
- const upcoming = all.filter((e) => e.data.date >= now).sort((a, b) => +a.data.date - +b.data.date);
18
- const past = all.filter((e) => e.data.date < now).sort((a, b) => +b.data.date - +a.data.date);
18
+ const upcoming = all.filter((e) => isUpcomingEvent(e.data, now)).sort((a, b) => +a.data.date - +b.data.date);
19
+ const past = all.filter((e) => !isUpcomingEvent(e.data, now)).sort((a, b) => +b.data.date - +a.data.date);
19
20
  const size = PAGINATION.pageSize;
20
21
  const total = Math.max(1, Math.ceil(past.length / size));
21
22
  return Array.from({ length: total }, (_, i) => ({
@@ -32,7 +33,7 @@ type EventEntry = (typeof upcoming)[number];
32
33
  const groupByYear = (events: EventEntry[]) => {
33
34
  const groups: { year: number; events: EventEntry[] }[] = [];
34
35
  for (const event of events) {
35
- const year = event.data.date.getFullYear();
36
+ const year = event.data.date.getUTCFullYear();
36
37
  const last = groups[groups.length - 1];
37
38
  if (last && last.year === year) last.events.push(event);
38
39
  else groups.push({ year, events: [event] });
@@ -7,6 +7,7 @@ import { safeCollection } from '../../lib/collections';
7
7
  import BaseLayout from '../../layouts/BaseLayout.astro';
8
8
  import AuthorBox from 'popular:component/AuthorBox';
9
9
  import { eventTalks } from '../../lib/talks';
10
+ import { dayKey, eventDays, formatEventDates, formatEventDay, isMultiDay } from '../../lib/eventdates';
10
11
 
11
12
  export async function getStaticPaths() {
12
13
  const events = (await safeCollection('events')).filter((e) => !e.data.draft);
@@ -16,7 +17,7 @@ export async function getStaticPaths() {
16
17
  const { event } = Astro.props;
17
18
  const d = event.data;
18
19
  const { Content } = await render(event);
19
- const dateStr = d.date.toLocaleDateString(SITE.locale, { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' });
20
+ const dateStr = formatEventDates(d, SITE.locale, { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' });
20
21
 
21
22
  /* Venue: a venueRef to the venues collection wins over the flat fields;
22
23
  its arrival notes are inherited unless the event sets venueNotes. */
@@ -37,12 +38,41 @@ const speakerEntries = d.speakers.map((slug) => {
37
38
  const talks = eventTalks(d, allSpeakers, event.id);
38
39
  const hasTalksArray = !!(d.talks && d.talks.length > 0);
39
40
 
41
+ /* An endDate before the start is ignored; say so, as Hugo does. */
42
+ if (d.endDate && dayKey(d.endDate) < dayKey(d.date)) {
43
+ console.warn(`events/${event.id}: endDate ${dayKey(d.endDate)} is before date ${dayKey(d.date)}, so it is ignored`);
44
+ }
45
+
46
+ /* Multi-day schedule: a talk with a `date` is listed under that day, days in
47
+ order and talks in the order they were written; talks with no `date` come
48
+ first, above the day headings. The day must fall inside the event's dates,
49
+ so a typo fails the build instead of quietly misfiling the talk. Any other
50
+ event keeps the order the talks were written in. */
51
+ const days = eventDays(d);
52
+ for (const t of talks) {
53
+ if (t.day && !days.some((day) => dayKey(day) === dayKey(t.day!))) {
54
+ throw new Error(`events/${event.id}: talk "${t.title}" is on ${dayKey(t.day)}, outside the event's dates (${dayKey(days[0])} to ${dayKey(days[days.length - 1])})`);
55
+ }
56
+ }
57
+ const scheduled = isMultiDay(d) && talks.some((t) => t.day);
58
+ const dayHeading = (day: Date) => formatEventDay(day, SITE.locale, { weekday: 'long', month: 'short', day: 'numeric', year: 'numeric' });
59
+ const talkGroups = scheduled
60
+ ? [
61
+ { heading: '', talks: talks.filter((t) => !t.day) },
62
+ ...days
63
+ .map((day) => ({ day, talks: talks.filter((t) => t.day && dayKey(t.day) === dayKey(day)) }))
64
+ .filter((group) => group.talks.length > 0)
65
+ .map((group) => ({ heading: dayHeading(group.day), talks: group.talks })),
66
+ ].filter((group) => group.talks.length > 0)
67
+ : [{ heading: '', talks }];
68
+
40
69
  /* schema.org/Event JSON-LD (see lib/eventld; contract in PARITY.md). */
41
70
  const siteUrl = absoluteUrl('/', Astro.site ?? Astro.url);
42
71
  const permalink = absoluteUrl(`/events/${event.id}/`, Astro.site ?? Astro.url);
43
72
  const eventLd = jsonld(buildEventLd({
44
73
  title: d.title,
45
74
  date: d.date,
75
+ endDate: d.endDate,
46
76
  time: d.time,
47
77
  description: d.description,
48
78
  cancelled: (d as any).cancelled,
@@ -111,8 +141,11 @@ const eventLd = jsonld(buildEventLd({
111
141
  <>
112
142
  <h2 style="font-size:var(--text-xl);margin:var(--space-5) 0 1rem">{STRINGS.talks}</h2>
113
143
  <div class="g-stack" style="gap:var(--space-3)">
114
- {talks.map((t) => (
144
+ {talkGroups.map((group) => (<>
145
+ {group.heading && <h3 class="g-schedule-day">{group.heading}</h3>}
146
+ {group.talks.map((t) => (
115
147
  <div class="g-talk">
148
+ {t.time && <div class="g-talk__time"><i class="fa-solid fa-clock" aria-hidden="true"></i> {t.time}</div>}
116
149
  <div class="g-talk__title">{t.title}</div>
117
150
  {t.speakerName && (
118
151
  <div class="g-talk__by"><i class="fa-solid fa-microphone-lines" aria-hidden="true"></i> {t.speakerSlug ? <a href={withBase(`/speakers/${t.speakerSlug}/`)}>{t.speakerName}</a> : t.speakerName}</div>
@@ -125,6 +158,7 @@ const eventLd = jsonld(buildEventLd({
125
158
  )}
126
159
  </div>
127
160
  ))}
161
+ </>))}
128
162
  </div>
129
163
  </>
130
164
  )}
@@ -2,6 +2,7 @@ import type { APIRoute } from 'astro';
2
2
  import { getCollection } from 'astro:content';
3
3
  import { buildIcs } from '../../lib/ical';
4
4
  import { absoluteUrl } from '../../lib/url';
5
+ import { eventLastDay } from '../../lib/eventdates';
5
6
  import { SITE } from 'popular:config';
6
7
 
7
8
  /* iCalendar feed: upcoming events plus the last 90 days. Mirrors the Hugo
@@ -10,7 +11,7 @@ export const GET: APIRoute = async ({ site }) => {
10
11
  const origin = site ?? new URL('https://example.com');
11
12
  const cutoff = Date.now() - 90 * 24 * 60 * 60 * 1000;
12
13
  const events = (await getCollection('events'))
13
- .filter((e) => !e.data.draft && +e.data.date >= cutoff)
14
+ .filter((e) => !e.data.draft && +eventLastDay(e.data) >= cutoff)
14
15
  .sort((a, b) => +a.data.date - +b.data.date);
15
16
  const venues = await getCollection('venues');
16
17
  const duration = (SITE as Record<string, any>).events?.defaultDurationMinutes ?? 120;
@@ -21,6 +22,7 @@ export const GET: APIRoute = async ({ site }) => {
21
22
  return {
22
23
  title: e.data.title,
23
24
  date: e.data.date,
25
+ endDate: e.data.endDate,
24
26
  time: e.data.time,
25
27
  description: (e.data.description ?? '').trim(),
26
28
  checkin: e.data.checkin,
@@ -5,20 +5,21 @@ import BaseLayout from '../layouts/BaseLayout.astro';
5
5
  import PostCard from 'popular:component/PostCard';
6
6
  import OrganizerCard from 'popular:component/OrganizerCard';
7
7
  import EventsEmpty from '../components/EventsEmpty.astro';
8
+ import { formatEventDates, isUpcomingEvent } from '../lib/eventdates';
8
9
  import { HOME, SITE, STRINGS, SECTIONS_MAP, SOCIAL } from 'popular:config';
9
10
  import { buildOrgLd, jsonld } from '../lib/jsonld';
10
11
  import { withBase, absoluteUrl } from '../lib/url';
11
12
 
12
13
  const now = new Date();
13
14
  const events = (await safeCollection('events')).filter((e) => !e.data.draft);
14
- const upcoming = events.filter((e) => e.data.date >= now).sort((a, b) => +a.data.date - +b.data.date);
15
+ const upcoming = events.filter((e) => isUpcomingEvent(e.data, now)).sort((a, b) => +a.data.date - +b.data.date);
15
16
  const next = upcoming[0];
16
17
 
17
18
  const posts = (await safeCollection('blog')).filter((p) => !p.data.draft).sort((a, b) => +b.data.date - +a.data.date).slice(0, 3);
18
19
  /* Stat values: @pastEventCount and @count:<section>[:rounded] resolve to
19
20
  live numbers (Hugo parity, see lib/stats). Draft entries are excluded to
20
21
  match Hugo's RegularPages. */
21
- const pastCount = events.filter((e) => e.data.date < now).length;
22
+ const pastCount = events.filter((e) => !isUpcomingEvent(e.data, now)).length;
22
23
  const counts: Record<string, number> = {};
23
24
  for (const name of countSectionsIn(HOME.stats ?? [])) {
24
25
  counts[name] = (await safeCollection(name)).filter((e) => !(e.data as any)?.draft).length;
@@ -110,7 +111,7 @@ const orgLd = jsonld(buildOrgLd({
110
111
  <span class="g-badge g-badge--soft"><i class="fa-solid fa-calendar" aria-hidden="true"></i> {STRINGS.nextMeetup}</span>
111
112
  <h2 style="margin:0">{next.data.title}</h2>
112
113
  <div class="g-meta-line">
113
- <span><i class="fa-solid fa-calendar-day" aria-hidden="true"></i> {next.data.date.toLocaleDateString(SITE.locale, { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' })}{next.data.time && ` · ${next.data.time}`}</span>
114
+ <span><i class="fa-solid fa-calendar-day" aria-hidden="true"></i> {formatEventDates(next.data, SITE.locale, { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' })}{next.data.time && ` · ${next.data.time}`}</span>
114
115
  <span><i class="fa-solid fa-location-dot" aria-hidden="true"></i> {nextVenue ?? next.data.venue ?? STRINGS.venueTba}</span>
115
116
  </div>
116
117
  {next.data.description && <p style="margin:0;color:var(--text-muted);max-width:34rem">{next.data.description}</p>}
@@ -1,6 +1,7 @@
1
1
  import type { APIRoute } from 'astro';
2
2
  import { getCollection } from 'astro:content';
3
3
  import { absoluteUrl } from '../lib/url';
4
+ import { formatEventDates, isUpcomingEvent, type EventSpan } from '../lib/eventdates';
4
5
  import { SITE } from 'popular:config';
5
6
 
6
7
  /* §8 llms.txt: a build-time plain-text summary for AI agents. Names the next
@@ -15,19 +16,19 @@ export const GET: APIRoute = async ({ site }) => {
15
16
  const events = (await getCollection('events'))
16
17
  .filter((e) => !e.data.draft)
17
18
  .sort((a, b) => +a.data.date - +b.data.date);
18
- const next = events.find((e) => +e.data.date >= now);
19
+ const next = events.find((e) => isUpcomingEvent(e.data, now));
19
20
 
20
21
  const pageIds = new Set((await getCollection('pages')).map((p) => p.id));
21
22
  const chat = (SITE as Record<string, any>).community?.chat as { url: string; label?: string } | undefined;
22
23
  const talksOn = (SITE as Record<string, any>).talks === true;
23
- const fmt = (d: Date) =>
24
- d.toLocaleDateString(SITE.locale, { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' });
24
+ const fmt = (e: EventSpan) =>
25
+ formatEventDates(e, SITE.locale, { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric' });
25
26
 
26
27
  const lines: string[] = [`# ${SITE.title}`, ''];
27
28
  if (SITE.description) lines.push(SITE.description, '');
28
29
  lines.push(
29
30
  next
30
- ? `Next event: ${next.data.title} on ${fmt(next.data.date)}${next.data.time ? `, ${next.data.time}` : ''} (${abs(`/events/${next.id}/`)})`
31
+ ? `Next event: ${next.data.title} on ${fmt(next.data)}${next.data.time ? `, ${next.data.time}` : ''} (${abs(`/events/${next.id}/`)})`
31
32
  : 'No upcoming events are scheduled right now.',
32
33
  '',
33
34
  );
@@ -8,6 +8,7 @@
8
8
  import { SITE, STRINGS } from 'popular:config';
9
9
  import { safeCollection } from '../../lib/collections';
10
10
  import { collectTalks } from '../../lib/talks';
11
+ import { formatEventDay } from '../../lib/eventdates';
11
12
  import { withBase } from '../../lib/url';
12
13
  import BaseLayout from '../../layouts/BaseLayout.astro';
13
14
  import PageHero from 'popular:component/PageHero';
@@ -21,7 +22,7 @@ export async function getStaticPaths() {
21
22
 
22
23
  const { talks } = Astro.props;
23
24
  const tags = [...new Set(talks.flatMap((t) => t.tags))].sort();
24
- const fmt = (d: Date) => d.toLocaleDateString(SITE.locale, { month: 'short', day: 'numeric', year: 'numeric' });
25
+ const fmt = (d: Date) => formatEventDay(d, SITE.locale, { month: 'short', day: 'numeric', year: 'numeric' });
25
26
  ---
26
27
 
27
28
  <BaseLayout title={STRINGS.talks} description={STRINGS.talksLead}>
@@ -97,8 +97,8 @@ a.g-pager__num:hover, .g-pager__nav:hover { border-color: var(--color-primary);
97
97
  .g-quote__role { display: block; font-size: var(--text-sm); color: var(--text-muted); }
98
98
 
99
99
  /* Year heading for date-grouped lists (events) */
100
- .g-year { margin: var(--space-3) 0 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); color: var(--text-muted); }
101
- .g-year:first-child { margin-top: 0; }
100
+ .g-year, .g-schedule-day { margin: var(--space-3) 0 0; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: var(--tracking-wide); color: var(--text-muted); }
101
+ .g-year:first-child, .g-schedule-day:first-child { margin-top: 0; }
102
102
 
103
103
  /* ---------- Cards ---------- */
104
104
  .g-card {
@@ -344,7 +344,7 @@ pre:hover .g-copy, .g-copy:focus-visible { opacity: 1; }
344
344
  .g-talk__title { font-weight: var(--weight-medium); }
345
345
  .g-talk__by { font-size: var(--text-sm); color: var(--text-muted); }
346
346
  .g-talk__by a { color: var(--text-link); }
347
- .g-talk__event { font-size: var(--text-sm); color: var(--text-muted); }
347
+ .g-talk__event, .g-talk__time { font-size: var(--text-sm); color: var(--text-muted); }
348
348
  .g-talk__event a { color: var(--text-link); }
349
349
 
350
350
  /* Photo gallery + pullquote (§6). No JS, no lightbox: each photo links to its