fix: make some changes
Some checks failed
Deploy to SFTP Server / build (push) Failing after 8m2s

This commit is contained in:
Max Richter
2025-10-21 19:38:33 +02:00
parent 06e5126fe0
commit 5ba54fee6e
29 changed files with 153 additions and 45 deletions

View File

@@ -5,39 +5,42 @@ import * as memorium from "@helpers/memorium";
import { resources as resourceTypes } from "../resources.ts";
import markdownToText from "@helpers/markdownToText";
const { resourceType, resourceName } = Astro.params;
const { resourceType, resourceName } = Astro?.params;
const path = useTranslatedPath(Astro.url);
export async function getStaticPaths(props) {
const paths = await Promise.all(resourceTypes.map(async (resourceType: string) => {
const resources = await memorium.listResource(resourceType.id);
return resources.content.map((res: any) => {
return {
params: {
resourceType: resourceType.id,
resourceName: res.name.replace(/\.md$/,"")
},
};
});
}));
export async function getStaticPaths() {
try {
const paths = await Promise.all(
resourceTypes.map(async (resourceType) => {
const resources = await memorium.listResource(resourceType.id);
return resources?.content.map((res: any) => {
return {
params: {
resourceType: resourceType.id,
resourceName: res.name.replace(/\.md$/, ""),
},
};
});
}),
);
const flat = paths.flat();
console.log(flat.map(p => `/resources/${p.params.resourceType}/${p.params.resourceName}`))
return flat;
return paths.flat().filter(Boolean);
}catch(err){
return []
}
}
const resource = await memorium.listResource(
`/${resourceType}/${resourceName}.md`
`/${resourceType}/${resourceName}.md`,
);
---
<Layout title="Max Richter">
<div class="top-info flex items-center place-content-between m-y-2">
<a class="flex items-center gap-1 opacity-50" href={path("/resources/"+resourceType)}>
<a
class="flex items-center gap-1 opacity-50"
href={path("/resources/" + resourceType)}>
<span class="i-tabler-arrow-left"></span> back
</a>
<div class="date opacity-50">
@@ -55,11 +58,19 @@ const resource = await memorium.listResource(
<p>{resource?.content?.description}</p>
<h2>Ingredients</h2>
<ul>
{resource.content.recipeIngredient.map(ingredient => <li>{markdownToText(ingredient)}</li>)}
{
resource.content.recipeIngredient.map((ingredient) => (
<li>{markdownToText(ingredient)}</li>
))
}
</ul>
<h2>Steps</h2>
<ol>
{resource.content.recipeInstructions.map(ingredient => <li>{markdownToText(ingredient)}</li>)}
{
resource.content.recipeInstructions.map((ingredient) => (
<li>{markdownToText(ingredient)}</li>
))
}
</ol>
</Layout>

View File

@@ -8,12 +8,12 @@ const { resourceType } = Astro.params;
const resources = await memorium.listResource(resourceType);
export async function getStaticPaths(): string[] {
export async function getStaticPaths() {
return resourceTypes.map((type: any) => {
return {
params: {
resourceType: type.id,
resourceName: "Recipe"
resourceName: "Recipe",
},
};
});
@@ -21,17 +21,22 @@ export async function getStaticPaths(): string[] {
---
<Layout title="Max Richter">
{ resources.content.filter(res => res && res?.content && res?.content?.name).map((resource: any) => (
<HeroCard
post={{
collection: "resources/"+resourceType,
id: resource.name.replace(/\.md$/,""),
data: {
title: resource.content.name,
cover: {src:`https://marka.max-richter.dev/${resource.content.image}`}
},
}}
/>
))
{
resources.content
.filter((res) => res && res?.content && res?.content?.name)
.map((resource: any) => (
<HeroCard
post={{
collection: "resources/" + resourceType,
id: resource.name.replace(/\.md$/, ""),
data: {
title: resource.content.name,
cover: {
src: `https://marka.max-richter.dev/${resource.content.image}`,
},
},
}}
/>
))
}
</Layout>