Skip to content

Conversation

@L4Ph
Copy link
Collaborator

@L4Ph L4Ph commented Jun 4, 2025

Unresolved issues

I've got most of the work done.
I'm having a small problem, can @saicaca help me?

close #232 #240

@vercel
Copy link

vercel bot commented Jun 4, 2025

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

@L4Ph L4Ph changed the title Astro v5 with new API(Astro Content Loader API) [WIP] Astro v5 with new API(Astro Content Loader API) Jun 4, 2025
@L4Ph
Copy link
Collaborator Author

L4Ph commented Jun 4, 2025

 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?

@saicaca saicaca self-assigned this Jun 4, 2025
@L4Ph L4Ph self-assigned this Jun 4, 2025
@L4Ph
Copy link
Collaborator Author

L4Ph commented Jun 9, 2025

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

@saicaca
Copy link
Owner

saicaca commented Jun 9, 2025

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.

@CuteLeaf
Copy link

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

image image

@Xeonzilla
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WIP] Astro v5 ToDo

4 participants