added image size
This commit is contained in:
@@ -9,6 +9,8 @@ const API_URL = process.env.PUBLIC_API_URL || 'http://localhost:3000';
|
||||
interface CoverImage {
|
||||
url: string;
|
||||
alt: string;
|
||||
w?: number;
|
||||
h?: number;
|
||||
}
|
||||
|
||||
interface Post {
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user