This commit is contained in:
Reid 2024-12-09 17:23:11 -08:00
parent 62d2b3717a
commit c697e7a278
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
11 changed files with 1136 additions and 2331 deletions

View file

@ -1,25 +1,25 @@
---
import { getEntry } from "astro:content";
import { getCollection } from "astro:content";
const badges = await getEntry("badges", "badges");
const badges = await getCollection("badges");
---
<div class="badges">
{badges.data.map((badge) => {
const hasHref = badge.href !== undefined;
{badges.map((badge) => {
const hasHref = badge.data.href !== undefined;
// ugh.
// i wish we could dedupe this, but im not sure how
return <>
{hasHref ? <a href={badge.href} target="_blank" rel="noreferrer noopener">
{typeof badge.path !== "string"
? <img src={badge.path.src} alt={badge.alt} title={badge.title} loading="lazy" decoding="async" width="88" height="31"/>
: <img src={badge.path} alt={badge.alt} title={badge.title} loading="lazy" decoding="async" width="88" height="31"/>
{hasHref ? <a href={badge.data.href} target="_blank" rel="noreferrer noopener">
{typeof badge.data.path !== "string"
? <img src={badge.data.path.src} alt={badge.data.alt} title={badge.data.title} loading="lazy" decoding="async" width="88" height="31"/>
: <img src={badge.data.path} alt={badge.data.alt} title={badge.data.title} loading="lazy" decoding="async" width="88" height="31"/>
}
</a> : <>
{typeof badge.path !== "string"
? <img src={badge.path.src} alt={badge.alt} title={badge.title} loading="lazy" decoding="async" width="88" height="31"/>
: <img src={badge.path} alt={badge.alt} title={badge.title} loading="lazy" decoding="async" width="88" height="31"/>
{typeof badge.data.path !== "string"
? <img src={badge.data.path.src} alt={badge.data.alt} title={badge.data.title} loading="lazy" decoding="async" width="88" height="31"/>
: <img src={badge.data.path} alt={badge.data.alt} title={badge.data.title} loading="lazy" decoding="async" width="88" height="31"/>
}
</>}
</>;