added image size

This commit is contained in:
2026-05-14 18:07:08 +02:00
parent ceb3750add
commit 2ace527c9f
4 changed files with 27 additions and 4 deletions
+3 -2
View File
@@ -8,7 +8,7 @@ import { renderMarkdown } from '../../lib/markdown';
const { slug } = Astro.params;
const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000';
interface CoverImage { url: string; alt: string }
interface CoverImage { url: string; alt: string; w?: number; h?: number }
interface PostNeighbor {
slug: string;
title?: string;
@@ -26,6 +26,7 @@ interface PostDetail {
image_count: number;
prev?: PostNeighbor;
next?: PostNeighbor;
dimensions?: Record<string, { w: number; h: number }>;
}
function formatDate(d: string) {
@@ -45,7 +46,7 @@ try {
const postRes = await fetch(`${API_URL}/api/posts/${encodeURIComponent(slug ?? '')}`);
if (postRes.ok) {
post = await postRes.json();
html = renderMarkdown(post!.content);
html = renderMarkdown(post!.content, post!.dimensions);
} else {
error = 'Work not found in the catalogue';
}