fix: images in remotes
All checks were successful
Deploy to SFTP Server / build (push) Successful in 9m22s

This commit is contained in:
Max Richter
2025-10-22 16:00:21 +02:00
parent 2446629515
commit 24a66940e9
6 changed files with 129 additions and 131 deletions

View File

@@ -3,6 +3,7 @@ import Layout from "@layouts/Layout.astro";
import HeroCard from "@components/HeroCard.astro";
import * as memorium from "@helpers/memorium";
import { resources as resourceTypes } from "../resources.ts";
import markdownToText from "@helpers/markdownToText";
const { resourceType } = Astro.params;
@@ -10,7 +11,7 @@ async function safeGetResource(resType) {
try {
return await memorium.listResource(resourceType);
} catch (error) {
return {content:[]};
return { content: [] };
}
}
@@ -26,6 +27,19 @@ export async function getStaticPaths() {
};
});
}
function getImageUrl(input: string): string {
if (!input) {
return;
}
if (input.startsWith("https://") || input.startsWith("http://")) {
return input;
}
if (input.startsWith("/")) {
return `https://marka.max-richter.dev${input}`;
}
return `https://marka.max-richter.dev/${input}`;
}
---
<Layout title="Max Richter">
@@ -40,7 +54,7 @@ export async function getStaticPaths() {
data: {
title: resource.content.name,
cover: {
src: `https://marka.max-richter.dev/${resource.content.image}`,
src: getImageUrl(resource.content.image),
},
},
}}