[WIP] Astro v5 with new API(Astro Content Loader API)
Unresolved issues
- [ ] can't find the cover image I'm loading at the same level as the markdown file
- [x] In ArchivePanel.svelte, post.id is not typed (becomes any)
- [x] ~~https://github.com/saicaca/fuwari/pull/493#issuecomment-2960562119~~
I've got most of the work done. I'm having a small problem, can @saicaca help me?
close #232 #240
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| fuwari-yags | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 4, 2025 2:20pm |
title: Simple Guides for Fuwari
published: 2024-04-01
description: "How to use this blog template."
-image: "./cover.jpeg"
+image: "./guide/cover.jpeg" or "/guide/cover.jpeg"
tags: ["Fuwari", "Blogging", "Customization"]
category: Guides
draft: false
I can take an image this way, but it doesn't seem to be the code I'm expecting. Does it consider the posts directory to be some kind of root dir?
I've tried various things, but it seems there is no solution at the moment. If there is no reason, I'll close this PR by stating that relative paths cannot be used. Did you have any good ideas? @saicaca
Thank you for your effort. I might not have the enough time to tackle this problem recently. I think we can keep this PR open until we come up with a solution.
I have successfully solved this problem, but I don't know if it is the best solution. #670
diff --git a/src/utils/url-utils.ts b/src/utils/url-utils.ts
index c055f33..36aabfa 100644
--- a/src/utils/url-utils.ts
+++ b/src/utils/url-utils.ts
@@ -34,7 +34,7 @@ export function getCategoryUrl(category: string | null): string {
export function getDir(path: string): string {
const lastSlashIndex = path.lastIndexOf("/");
if (lastSlashIndex < 0) {
- return "/";
+ return path ? `${path}/` : "";
}
return path.substring(0, lastSlashIndex + 1);
}
I have a very simple solution, but it looks a bit tricky and may need more testing. At least, it works on my site.