fuwari icon indicating copy to clipboard operation
fuwari copied to clipboard

[WIP] Astro v5 with new API(Astro Content Loader API)

Open L4Ph opened this issue 6 months ago • 6 comments

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

L4Ph avatar Jun 04 '25 13:06 L4Ph

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

vercel[bot] avatar Jun 04 '25 13:06 vercel[bot]

 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?

L4Ph avatar Jun 04 '25 14:06 L4Ph

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

L4Ph avatar Jun 09 '25 08:06 L4Ph

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.

saicaca avatar Jun 09 '25 13:06 saicaca

I have successfully solved this problem, but I don't know if it is the best solution. #670

image image

CuteLeaf avatar Nov 17 '25 11:11 CuteLeaf

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.

Xeonzilla avatar Nov 17 '25 15:11 Xeonzilla