fix: images in remotes
All checks were successful
Deploy to SFTP Server / build (push) Successful in 9m22s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 9m22s
This commit is contained in:
@@ -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),
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user