better image generation

This commit is contained in:
ebby 2026-07-28 11:24:32 +02:00
parent 5108d5eacc
commit c662d4719b
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,7 @@
--- ---
import type { Post } from "../types/global"; import type { Post } from "../types/global";
import { findImageByPath } from "../lib/findImage"; import { findImageByPath } from "../lib/findImage";
import { Image } from "astro:assets";
interface Props { interface Props {
post: Post; post: Post;
@ -15,7 +16,11 @@ const img = findImageByPath(post.image.path);
<a href={url} class="no-link-link"> <a href={url} class="no-link-link">
<div class="wide-container"> <div class="wide-container">
<div class="image-col col rounded"> <div class="image-col col rounded">
<img src={img.src} alt={post.image.alt} /> <Image
src={img}
alt={post.image.alt}
layout="constrained"
/>
</div> </div>
<div class="text-col col"> <div class="text-col col">
<div class="top-info"> <div class="top-info">

View file

@ -1,4 +1,5 @@
--- ---
import { Image } from "astro:assets";
import BackNav from "../components/BackNav.astro"; import BackNav from "../components/BackNav.astro";
import { findImageByPath } from "../lib/findImage"; import { findImageByPath } from "../lib/findImage";
import type { Post } from "../types/global"; import type { Post } from "../types/global";
@ -15,9 +16,9 @@ const titleImg = findImageByPath(frontmatter.image.path);
<Main> <Main>
<article> <article>
<img <Image
id="titleImg" id="titleImg"
src={titleImg.src} src={titleImg}
alt={frontmatter.image.alt} alt={frontmatter.image.alt}
class="rounded" class="rounded"
/> />