Skip to content

Commit bc99b18

Browse files
authored
Merge pull request #784 from CodingCatDev/dev
chore: promote dev to main (CoverImage srcset, sponsor logos, and PodMatch removal)
2 parents 1dd1d1a + 287b601 commit bc99b18

9 files changed

Lines changed: 38 additions & 105 deletions

File tree

‎apps/site/src/components/CoverImage.astro‎

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,41 @@ const {
2222
quality = 82,
2323
sizes = "(max-width: 768px) 100vw, (max-width: 1280px) 50vw, 960px",
2424
priority = false,
25-
class: className = "w-full h-auto aspect-video rounded-md",
25+
class: className = "w-full h-auto aspect-video rounded-md object-cover",
2626
} = Astro.props;
2727
28+
const assetRef = stegaClean(
29+
(image as { asset?: { _ref?: string } } | null)?.asset?._ref,
30+
);
31+
const dimMatch = assetRef?.match(/-(\d+)x(\d+)-[a-z0-9]+$/i);
32+
const intrinsicWidth = dimMatch ? Number(dimMatch[1]) : undefined;
33+
2834
const builder = Astro.locals.sanity.urlForImage(image ?? undefined);
2935
const aspect = height / width;
36+
const isSquare = width === height;
37+
const maxWidth = intrinsicWidth ? Math.min(width, intrinsicWidth) : width;
38+
const maxHeight = Math.round(maxWidth * aspect);
39+
40+
const buildUrl = (w: number) => {
41+
if (!builder) return undefined;
42+
const b = builder.width(w);
43+
return (isSquare ? b.height(Math.round(w * aspect)) : b)
44+
.quality(quality)
45+
.url();
46+
};
3047
31-
const src = builder
32-
?.width(width)
33-
.height(height)
34-
.quality(quality)
35-
.url();
48+
const src = buildUrl(maxWidth);
3649
3750
const responsiveWidths = [320, 480, 640, 960, 1280, 1600, 1920].filter(
38-
(w) => w <= width,
51+
(w) => w <= maxWidth,
3952
);
40-
if (!responsiveWidths.includes(width)) {
41-
responsiveWidths.push(width);
53+
if (!responsiveWidths.includes(maxWidth)) {
54+
responsiveWidths.push(maxWidth);
4255
}
4356
const srcset = builder
4457
? responsiveWidths
4558
.map((w) => {
46-
const h = Math.round(w * aspect);
47-
const u = builder.width(w).height(h).quality(quality).url();
59+
const u = buildUrl(w);
4860
return `${u} ${w}w`;
4961
})
5062
.join(", ")
@@ -63,8 +75,8 @@ const alt = rawAlt && rawAlt.trim().length > 0 ? rawAlt : fallbackAlt;
6375
class={className}
6476
src={src}
6577
srcset={srcset}
66-
width={width}
67-
height={height}
78+
width={maxWidth}
79+
height={maxHeight}
6880
alt={alt}
6981
loading={priority ? "eager" : "lazy"}
7082
fetchpriority={priority ? "high" : "auto"}

‎apps/site/src/components/PodmatchBadge.astro‎

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

‎apps/site/src/lib/html-to-markdown.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ export function htmlToMarkdown(html: string, pageUrl?: string): string {
2424
/<div[^>]*class=["'][^"']*transcript-widget[^"']*["'][^>]*>[\s\S]*?<\/footer>\s*<\/div>\s*<\/div>\s*<\/div>/gi,
2525
"",
2626
)
27-
.replace(
28-
/<a[^>]*href=["']https:\/\/www\.podmatch\.com\/member\/codingcatdev["'][^>]*>[\s\S]*?<\/a>/gi,
29-
"",
30-
)
3127
.replace(/<button\b[^<]*(?:(?!<\/button>)<[^<]*)*<\/button>/gi, "")
3228
.replace(/<nav\b[^<]*(?:(?!<\/nav>)<[^<]*)*<\/nav>/gi, "")
3329
.replace(/<header\b[^<]*(?:(?!<\/header>)<[^<]*)*<\/header>/gi, "")

‎apps/site/src/pages/book.astro‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
import Breadcrumbs from "@/components/Breadcrumbs.astro";
3-
import PodmatchBadge from "@/components/PodmatchBadge.astro";
43
import BaseLayout from "@/layouts/BaseLayout.astro";
54
import { getMultiCalendarAvailableSlots } from "@/lib/google-calendar";
65
@@ -396,13 +395,12 @@ const description =
396395
</div>
397396
</div>
398397

399-
<!-- PodMatch Badge Footer -->
398+
<!-- Footer -->
400399
<footer class="flex flex-col sm:flex-row items-center justify-between gap-4 pt-8 border-t border-border">
401400
<div class="flex flex-col gap-1 text-center sm:text-left">
402-
<span class="text-xs font-semibold text-foreground">PodMatch Network Certified</span>
401+
<span class="text-xs font-semibold text-foreground">CodingCat.dev Studio</span>
403402
<span class="text-xs text-muted-foreground">Powered by CodingCat.dev &amp; Sanity Content Operating System</span>
404403
</div>
405-
<PodmatchBadge />
406404
</footer>
407405
</div>
408406
</BaseLayout>

‎apps/site/src/pages/contact.astro‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const description =
2626
<section>
2727
<h2 class="text-2xl font-bold mt-8 mb-4">Podcast Guest Appearances</h2>
2828
<p>
29-
Interested in being a guest on the CodingCat.dev Podcast? We love spotlighting developers building exciting tools, open source libraries, and novel developer experiences. You can connect with us directly via email or through our official PodMatch profile at
30-
<a href="https://www.podmatch.com/member/codingcatdev" target="_blank" rel="noopener noreferrer" class="text-primary hover:underline">PodMatch</a>.
29+
Interested in being a guest on the CodingCat.dev Podcast? We love spotlighting developers building exciting tools, open source libraries, and novel developer experiences. You can connect with us directly via email at
30+
<a href="mailto:alex@codingcat.dev" class="text-primary hover:underline">alex@codingcat.dev</a> or schedule a session on our <a href="/book" class="text-primary hover:underline">booking page</a>.
3131
</p>
3232
</section>
3333

‎apps/site/src/pages/index.astro‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
import AnimatedHero from "@/components/AnimatedHero.astro";
33
import HomeSection from "@/components/HomeSection.astro";
4-
import PodmatchBadge from "@/components/PodmatchBadge.astro";
54
import BaseLayout from "@/layouts/BaseLayout.astro";
65
import type { ContentListItem } from "@/lib/content";
76
import { SITE_DESCRIPTION } from "@/lib/site";
@@ -26,9 +25,6 @@ const latestPosts = (home?.latestPosts ?? []) as ContentListItem[];
2625
bare
2726
>
2827
<AnimatedHero />
29-
<div class="flex justify-center -mb-8">
30-
<PodmatchBadge />
31-
</div>
3228
<HomeSection
3329
title="Latest Podcasts"
3430
description="Check out our latest podcasts."

‎apps/site/src/pages/podcast/[slug].astro‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import CoverMedia from "@/components/CoverMedia.astro";
66
import FormattedDate from "@/components/FormattedDate.astro";
77
import PodcastListen from "@/components/PodcastListen.astro";
88
import PodcastPicks from "@/components/PodcastPicks.astro";
9-
import PodmatchBadge from "@/components/PodmatchBadge.astro";
109
import PortableTextContent from "@/components/portable-text/PortableTextContent.astro";
1110
import SectionHeader from "@/components/SectionHeader.astro";
1211
import SponsorCard from "@/components/SponsorCard.astro";
@@ -168,9 +167,6 @@ const faqNode = faqSchema(extractFaqsFromPortableText(podcast.content));
168167
<FormattedDate dateString={podcast.date} />
169168
</div>
170169
</div>
171-
<div class="m-2 flex justify-center md:m-8">
172-
<PodmatchBadge />
173-
</div>
174170
</div>
175171

176172
<PodcastListen
@@ -224,10 +220,6 @@ const faqNode = faqSchema(extractFaqsFromPortableText(podcast.content));
224220
}
225221
</article>
226222

227-
<div class="m-2 flex justify-center md:m-8">
228-
<PodmatchBadge />
229-
</div>
230-
231223
<PodcastPicks picks={podcast.pick} />
232224

233225
{

‎apps/site/src/pages/privacy.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const description =
4343
<section>
4444
<h2 class="text-2xl font-bold mt-8 mb-4">4. Third-Party Services</h2>
4545
<p>
46-
Our website may contain links to external websites, platforms, or services (such as YouTube, GitHub, PodMatch, X, and sponsor sites). We are not responsible for the privacy practices of external platforms. We encourage you to review the privacy policies of any third-party websites you visit.
46+
Our website may contain links to external websites, platforms, or services (such as YouTube, GitHub, X, and sponsor sites). We are not responsible for the privacy practices of external platforms. We encourage you to review the privacy policies of any third-party websites you visit.
4747
</p>
4848
</section>
4949

‎apps/site/src/pages/sponsor/[slug].astro‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ if (!sponsor?._id) {
2121
2222
const path = `/sponsor/${slug}`;
2323
const origin = Astro.locals.siteUrl.origin;
24-
const avatarUrl = sanity
24+
const ogCardImageUrl = sanity
2525
.urlForImage(sponsor.coverImage ?? undefined)
26-
?.width(256)
27-
.height(256)
28-
.fit("crop")
26+
?.width(640)
2927
.url();
3028
const rawExcerpt = sponsor.excerpt?.trim();
3129
const description =
@@ -47,7 +45,7 @@ const relatedPodcasts = (sponsor.related?.podcast ?? []) as ContentListItem[];
4745
title: sponsor.title,
4846
subtitle: description,
4947
type: "Sponsor",
50-
avatar: avatarUrl,
48+
image: ogCardImageUrl,
5149
}}
5250
canonical={path}
5351
schema={[
@@ -62,14 +60,14 @@ const relatedPodcasts = (sponsor.related?.podcast ?? []) as ContentListItem[];
6260
/>
6361

6462
<div class="flex w-full flex-col gap-4 md:gap-8">
65-
<div class="flex gap-2 md:gap-8">
63+
<div class="flex items-center gap-4 md:gap-8">
6664
<div class="shrink-0">
6765
<CoverMedia
6866
image={sponsor.coverImage}
69-
width={256}
70-
height={256}
71-
sizes="128px"
72-
class="size-24 rounded-md object-cover md:size-32"
67+
width={640}
68+
height={360}
69+
sizes="(max-width: 768px) 160px, 256px"
70+
class="h-auto w-40 max-h-32 rounded-md object-contain md:w-64"
7371
/>
7472
</div>
7573
<div class="flex flex-col gap-2">

0 commit comments

Comments
 (0)