Skip to content

Commit c8601ae

Browse files
committed
Remove custom lockdown images and just point to the site itself for dynamic image generation
1 parent 0e801fd commit c8601ae

3 files changed

Lines changed: 7 additions & 19 deletions

File tree

src/components/ShareRow.astro

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
*/
88
interface Props {
99
t: Record<string, string>;
10+
locale?: string;
1011
}
1112
12-
const { t } = Astro.props;
13-
const siteUrl = 'https://keepandroidopen.org';
13+
const { t, locale = 'en' } = Astro.props;
14+
const siteUrl = locale === 'en'
15+
? 'https://keepandroidopen.org'
16+
: `https://keepandroidopen.org/${locale}/`;
1417
1518
// Helper to get all variants for a prefix
1619
function getVariants(prefix: string): string[] {

src/layouts/Base.astro

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
import { languages, isRtl } from '../i18n/config';
33
import ThemeToggle from '../components/ThemeToggle.astro';
4-
import { glob } from 'node:fs/promises';
54
65
interface Props {
76
title: string;
@@ -16,15 +15,6 @@ const {
1615
} = Astro.props;
1716
1817
const dir = isRtl(lang) ? "rtl" : "ltr";
19-
20-
// Pick a random lockdown image at build time for social media previews
21-
const lockdownImages: string[] = [];
22-
for await (const entry of glob('public/img/lockdowns/*.{png,jpg,jpeg,webp}')) {
23-
lockdownImages.push(entry.replace(/^public/, ''));
24-
}
25-
const ogImage = lockdownImages.length > 0
26-
? `https://keepandroidopen.org${lockdownImages[Math.floor(Math.random() * lockdownImages.length)]}`
27-
: 'https://keepandroidopen.org/img/keepandroidopen.png';
2818
---
2919
<!DOCTYPE html>
3020
<html lang={lang} dir={dir}>
@@ -33,16 +23,11 @@ const ogImage = lockdownImages.length > 0
3323
<meta charset="UTF-8">
3424
<meta http-equiv="X-UA-Compatible" content="IE=edge">
3525
<meta name="viewport" content="width=device-width, initial-scale=1">
36-
<meta name="viewport" content="width=device-width, initial-scale=1">
3726
<meta name="color-scheme" content="light dark">
3827
<meta name="description" content={description}>
3928
<meta property="og:title" content={title}>
4029
<meta property="og:description" content={description}>
41-
<meta property="og:image" content={ogImage}>
4230
<meta property="og:type" content="website">
43-
<meta name="twitter:card" content="summary">
44-
<meta name="twitter:title" content={title}>
45-
<meta name="twitter:image" content={ogImage}>
4631
<link rel="me" href="https://techhub.social/@keepandroidopen">
4732
<link rel="stylesheet" href="/css/pico.min.css">
4833

src/layouts/Landing.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const homePath = locale === 'en' ? '/' : `/${locale}/`;
8787
<a href="#what" class="scroll-cue" aria-label="Read more">&#8595;</a>
8888

8989
<p class="share-heading" set:html={t.closing_share_heading} />
90-
<ShareRow t={t} />
90+
<ShareRow t={t} locale={locale} />
9191
</section>
9292

9393
<!-- What's happening -->
@@ -304,7 +304,7 @@ const homePath = locale === 'en' ? '/' : `/${locale}/`;
304304
<p class="closing-lede"><Fragment set:html={t.closing_line1} /><br><Fragment set:html={t.closing_line2} /></p>
305305
<p set:html={t.closing_detail} />
306306
<p class="closing-cta"><strong><Fragment set:html={t.closing_cta} /></strong></p>
307-
<ShareRow t={t} />
307+
<ShareRow t={t} locale={locale} />
308308
</section>
309309
</main>
310310

0 commit comments

Comments
 (0)