Skip to content

Commit 38b0d50

Browse files
committed
Generate sessions and speakers from json files.
1 parent b05dd26 commit 38b0d50

File tree

21 files changed

+492
-117
lines changed

21 files changed

+492
-117
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ dmypy.json
128128
.pyre/
129129

130130
.vscode/
131+
.idea/
131132
out/
132133
.next/
133134
.DS_Store
@@ -138,3 +139,11 @@ storybook-static/
138139
# Sentry Auth Token
139140
.sentryclirc
140141
.astro
142+
143+
# EuroPython website
144+
src/content/speakers
145+
src/content/sessions
146+
src/content/days
147+
src/data/speakers.json
148+
src/data/sessions.json
149+
src/data/schedule.json

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
1919
# Replace "/" and other non-alphanumeric characters with "-"
2020
SAFE_BRANCH := $(shell echo "$(BRANCH)" | sed 's/[^A-Za-z0-9-]/-/g')
2121
FORCE_DEPLOY ?= false
22+
SITE_URL ?= "https://$(SAFE_BRANCH).ep-preview.click"
2223

2324
.PHONY: build deploy dev clean install
2425

25-
2626
safe_branch:
2727
@echo $(SAFE_BRANCH)
2828

@@ -31,6 +31,8 @@ pre:
3131

3232
install:
3333
pnpm install
34+
pnpm update_data
35+
pnpm generate_content
3436

3537
dev:
3638
pnpm dev
@@ -47,6 +49,7 @@ build:
4749
preview: RELEASES_DIR = $(VPS_PREVIEW_PATH)/$(SAFE_BRANCH)/releases
4850
preview: TARGET = $(RELEASES_DIR)/$(TIMESTAMP)
4951
preview:
52+
@echo "Preview site URL: $(SITE_URL)" # Output preview URL
5053
echo $(TARGET)
5154
@echo "\n\n**** Deploying preview of a branch '$(BRANCH)' (safe: $(SAFE_BRANCH)) to $(TARGET)...\n\n"
5255
$(REMOTE_CMD) "mkdir -p $(TARGET)"

astro.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import path from "path";
1+
import path, { dirname } from "path";
2+
import { fileURLToPath } from "url";
23
import { defineConfig } from "astro/config";
34
import mdx from "@astrojs/mdx";
45
import sitemap from "@astrojs/sitemap";
@@ -76,7 +77,11 @@ export default defineConfig({
7677
build: {
7778
minify: true,
7879
},
80+
image: {
81+
experimentalLayout: "responsive",
82+
},
7983
experimental: {
84+
responsiveImages: true,
8085
svg: true,
8186
},
8287
});

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",
8-
"build": "astro check && astro build && pnpm pagefind --site dist",
8+
"build": "pnpm generate_content && astro check && astro build && pnpm pagefind --site dist",
9+
"update_data": "NODE_TLS_REJECT_UNAUTHORIZED=0 node src/scripts/fetchData.js",
10+
"generate_content": "node src/scripts/generateContent.js",
911
"preview": "astro preview",
1012
"astro": "astro",
1113
"format": "prettier --write --plugin=prettier-plugin-astro ."
@@ -29,6 +31,8 @@
2931
"date-fns": "^4.1.0",
3032
"date-fns-tz": "^3.2.0",
3133
"hastscript": "^9.0.0",
34+
"js-yaml": "^4.1.0",
35+
"marked": "^15.0.7",
3236
"pagefind": "^1.3.0",
3337
"react": "^19.1.0",
3438
"react-dom": "^19.1.0",
@@ -40,6 +44,7 @@
4044
"typescript": "^5.8.3"
4145
},
4246
"devDependencies": {
47+
"@types/js-yaml": "^4.0.9",
4348
"prettier": "^3.4.2",
4449
"prettier-plugin-astro": "^0.14.1"
4550
},

pnpm-lock.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/favicon.ico

56.6 KB
Binary file not shown.

scripts/download-data.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/components/schedule/speakers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const speakers = Astro.props.speakers
2020

2121
{
2222
speakers.map((speaker, index) => (
23-
<a href={`/speaker/${speaker.slug}`} class="inline">
23+
<a href={`/speaker/${speaker.id}`} class="inline">
2424
{speaker.data.name}
2525
{index < speakers.length - 1 ? ", " : ""}
2626
</a>

src/components/session-speakers.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const speakers = await getEntries(
2121
{
2222
speakers.map((speaker, index) => (
2323
<span class="inline">
24-
<a href={`/speaker/${speaker.slug}`} class="underline">
24+
<a href={`/speaker/${speaker.id}`} class="underline">
2525
{speaker.data.name}
2626
</a>
2727
{index < speakers.length - 1 ? ", " : ""}

src/components/ui/Markdown.astro

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
import { marked } from 'marked';
3+
4+
interface Props {
5+
content: string;
6+
}
7+
8+
const { content } = Astro.props;
9+
const html = marked.parse(content);
10+
---
11+
12+
<div class="prose prose-xl max-w-none" >
13+
<article set:html={html} />
14+
</div>

src/content/config.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineCollection, reference, z } from "astro:content";
2+
import { file } from "astro/loaders";
23

34
const tiers = [
45
"Keystone",
@@ -55,11 +56,13 @@ const keynoters = defineCollection({
5556
});
5657

5758
const speakers = defineCollection({
58-
type: "content",
59+
loader: file("src/content/speakers/data.json"),
5960
schema: z.object({
6061
code: z.string(),
6162
name: z.string(),
63+
slug: z.string(),
6264
avatar: z.string(),
65+
biography: z.string().nullable(),
6366
submissions: z.array(reference("sessions")),
6467
affiliation: z.string().nullable(),
6568
homepage: z.string().nullable(),
@@ -71,10 +74,12 @@ const speakers = defineCollection({
7174
});
7275

7376
const sessions = defineCollection({
74-
type: "content",
77+
loader: file("src/content/sessions/data.json"),
7578
schema: z.object({
7679
code: z.string(),
7780
title: z.string(),
81+
slug: z.string(),
82+
abstract: z.string().nullable(),
7883
speakers: z.array(reference("speakers")),
7984
session_type: z.string(),
8085
track: z.string().nullable(),
@@ -85,7 +90,7 @@ const sessions = defineCollection({
8590
.nullable(),
8691
duration: z.string(),
8792
level: z.enum(["beginner", "intermediate", "advanced"]),
88-
delivery: z.enum(["in-person", "remote"]),
93+
delivery: z.enum(["in-person", "remote", ""]),
8994
room: z.string().nullable(),
9095
start: z.string().nullable(),
9196
end: z.string().nullable(),

src/content/sessions/.gitkeep

Whitespace-only changes.

src/content/speakers/.gitkeep

Whitespace-only changes.

src/data/links.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
"name": "Community Voting",
2020
"path": "/programme/voting"
2121
},
22+
{
23+
"name": "List of Speakers",
24+
"path": "/speakers"
25+
},
2226
{
2327
"name": "Speaker Mentorship",
2428
"path": "/programme/mentorship"

0 commit comments

Comments
 (0)