astro-paper icon indicating copy to clipboard operation
astro-paper copied to clipboard

Blog header should support blog deployed at <root.url/base> in addition to <root.url>

Open davidandreoletti opened this issue 1 year ago • 5 comments

Blog header should not hardcode website root to / but /<base> to support website deployed at /<base>.

When <base> is empty, the original behaviour is preserved.

davidandreoletti avatar Jun 05 '24 03:06 davidandreoletti

Do a PR

No1ceTea avatar Jun 05 '24 14:06 No1ceTea

I initially considered it.

However, I decided to develop my own blog from scratch.

Easier to satisfy all my current and future requirements.

davidandreoletti avatar Jun 08 '24 11:06 davidandreoletti

Okay, Good luck ! I am intersted, when you finish it, feel free to share it to me !

No1ceTea avatar Jun 10 '24 09:06 No1ceTea

Thank you.

Unfortunately, this will be a private repo.

davidandreoletti avatar Jun 11 '24 10:06 davidandreoletti

Hello @davidandreoletti You mean something like this?

import { SITE } from "@config";

---
<a href={SITE.website ?? "/"}>Home</a>

satnaing avatar Jul 22 '24 15:07 satnaing

I think you meant something like this. (Correct me if I'm wrong)

<a
  href=`${import.meta.env.BASE_URL}/posts/`
  class={activeNav === "posts" ? "active" : ""}
>
  Posts
</a>

The thing is that it is not suitable for every scenario. It works if base is specified properly other than /. It won't work well if base is not specified or set to /.

The docs itself is suggesting like this:

<p>Read more <a href="/about/">about</a> Astro!</p>

<!-- With `base: "/docs"` configured -->
<p>Learn more in our <a href="/docs/reference/">reference</a> section!</p>

Please, do let me know if you have any solution I missed. @davidandreoletti Thanks.

satnaing avatar Jul 24 '24 16:07 satnaing

Closing this issue for now. Feel free to reopen it if you’d like to continue the discussion. Thanks for your understanding.

satnaing avatar Aug 02 '24 11:08 satnaing