diff --git a/astro.config.mjs b/astro.config.mjs index dcbeed6a7..159759957 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -90,7 +90,9 @@ export default defineConfig({ metaTags(), pagefind(), deleteUnusedImages(), - compress(), + (await import("astro-compress")).default({ + SVG: false, + }), ], output: "static", build: { diff --git a/public/social/bg2.png b/public/social/bg2.png new file mode 100644 index 000000000..c46841fb4 Binary files /dev/null and b/public/social/bg2.png differ diff --git a/public/social/bg3.png b/public/social/bg3.png new file mode 100644 index 000000000..b6935d904 Binary files /dev/null and b/public/social/bg3.png differ diff --git a/public/social/bg4.png b/public/social/bg4.png new file mode 100644 index 000000000..e1e1ad66a Binary files /dev/null and b/public/social/bg4.png differ diff --git a/scripts/download_social.cjs b/scripts/download_social.cjs index 5c6c19fbf..e5034b2c2 100644 --- a/scripts/download_social.cjs +++ b/scripts/download_social.cjs @@ -6,7 +6,7 @@ const puppeteer = require("puppeteer"); args: ["--no-sandbox", "--disable-setuid-sandbox"], }); const page = await browser.newPage(); - await page.goto("http://localhost:4321/media/social_media_cards"); + await page.goto("http://localhost:4321/media/speakers"); const elements = await page.$$(".social"); diff --git a/src/components/SocialMediaSponsorCard.astro b/src/components/SocialMediaSponsorCard.astro new file mode 100644 index 000000000..a06c7c99d --- /dev/null +++ b/src/components/SocialMediaSponsorCard.astro @@ -0,0 +1,114 @@ +--- +import { getEntry } from "astro:content"; +import { sponsorLogos } from "@data/sponsorLogos"; + +const { sponsor } = Astro.props; + +const { + name: title, + url: website, + logo_padding = false, +} = sponsor.data; + + +const logo = sponsorLogos[sponsor.id]; +// Assuming logo.width and logo.height are known +const targetWidth = 400; +const originalWidth = logo.width; +const originalHeight = logo.height; +const aspectRatio = originalWidth / originalHeight; + +let width = targetWidth; +let height = width / aspectRatio; + +const maxHeight = 220; +if (height > maxHeight) { + height = maxHeight; + width = height * aspectRatio ; +} + +const x = 450 - width / 2; +const y = 650 - height / 2; + +--- + + + +
+{title} +
+ + + diff --git a/src/pages/media/social_media.csv.ts b/src/pages/media/social_media.csv.ts deleted file mode 100644 index 3448c9002..000000000 --- a/src/pages/media/social_media.csv.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { getCollection, getEntry } from "astro:content"; -export async function GET() { - const speakers = await getCollection("speakers"); - - const header = [ - "Talk Title", - "Speaker Name", - "Speaker Photo URL", - "Primary Social ULR", - "X URL", - "LinkedIn URL", - "Bluesky URL", - "Mastodon URL", - ]; - - const exclude = [ - "sebastian-ramirez", - "savannah-ostrowski", - "nerea-luis", - "petr-baudis", - "brett-cannon", - ]; - - const rows: string[][] = []; - - for (const speaker of speakers) { - if (exclude.includes(speaker.id)) continue; - - const { - name, - twitter_url, - linkedin_url, - bluesky_url, - mastodon_url, - submissions, - } = speaker.data; - - const sessions = await Promise.all( - submissions.map((session) => getEntry("sessions", session.id)) - ); - - for (const session of sessions) { - if (session) { - const speaker_page = `https://ep2025.europython.eu/speaker/${speaker.id}`; - rows.push([ - session.data.title || "", - name, - `https://ep2025-buffer.ep-preview.click/media/social-${speaker.id}.png`, - twitter_url || linkedin_url || mastodon_url || speaker_page, - twitter_url ?? speaker_page, - linkedin_url ?? speaker_page, - bluesky_url ?? speaker_page, - mastodon_url ?? speaker_page, - ]); - } - } - } - - const csvLines = [header, ...rows] - .map((row) => - row - .map((field) => - field.includes('"') || field.includes(",") || field.includes("\n") - ? `"${field.replace(/"/g, '""')}"` - : field - ) - .join(",") - ) - .join("\r\n"); - - return new Response(csvLines, { - status: 200, - headers: { - "Content-Type": "text/csv; charset=utf-8", - "Content-Disposition": 'attachment; filename="social_media.csv"', - }, - }); -} diff --git a/src/pages/media/card/[slug].astro b/src/pages/media/speaker/[slug].astro similarity index 100% rename from src/pages/media/card/[slug].astro rename to src/pages/media/speaker/[slug].astro diff --git a/src/pages/media/social_media_cards.astro b/src/pages/media/speakers.astro similarity index 97% rename from src/pages/media/social_media_cards.astro rename to src/pages/media/speakers.astro index 8d5266ffc..6ebae735f 100644 --- a/src/pages/media/social_media_cards.astro +++ b/src/pages/media/speakers.astro @@ -20,7 +20,7 @@ type Speaker = CollectionEntry<"speakers">; { speakers.map((entry: Speaker) => ( - + diff --git a/src/pages/media/sponsor/[slug].astro b/src/pages/media/sponsor/[slug].astro new file mode 100644 index 000000000..7fb0bcdff --- /dev/null +++ b/src/pages/media/sponsor/[slug].astro @@ -0,0 +1,131 @@ +--- +import { getEntry, getCollection} from "astro:content"; +import SocialMediaSponsorCard from "@components/SocialMediaSponsorCard.astro"; + +export async function getStaticPaths() { + const entries = await getCollection("sponsors"); + return entries.map((entry) => ({ + params: { slug: entry.id}, + props: { entry }, + })); +} + +const { entry:sponsor } = Astro.props; + +--- + + + + + + + + + + + + +{ + sponsor && + +} + + + + + + + + + diff --git a/src/pages/media/sponsors.astro b/src/pages/media/sponsors.astro new file mode 100644 index 000000000..43671e941 --- /dev/null +++ b/src/pages/media/sponsors.astro @@ -0,0 +1,82 @@ +--- +import { getCollection, type CollectionEntry } from "astro:content"; +import SocialMediaSponsorCard from "@components/SocialMediaSponsorCard.astro"; + + +const sponsors = await getCollection("sponsors"); +type Sponsor = CollectionEntry<"sponsors">; +--- + + + + + + + + + + + + +{ + sponsors.map((sponsor: Sponsor) => ( + + + + )) +} + + + + + + +