The landing page loads perfectly but as soon as any post link is clicked the page goes to 404 -There isn't a GitHub Pages site here.
I notice that by default the landing page is abhigyansrivastava.github.io/Astroboy but when i click on any post link it goes to https://abhigyansrivastava.github.io/posts/cover-image/ .
Astroboy folder is missing in the second link.
Solution please.
Using github pages. Site and base are mentioned in the astro.config.ts file.
#Broken links throughout
6 messages · Page 1 of 1 (latest)
That template probably didn't consider being hosted at a different base path.
If you want to use that template in a different base path, you can add the missing base yourself where needed.
For example, in src/components/BaseHead.astro, and https://github.com/AbhigyanSrivastava/Astroboy/blob/125e4fd4018fe7b8a7dd46da92eb81c4f818fe43/src/components/blog/PostPreview.astro#L17
You can read the current base url from import.meta.env.BASE_URL
https://docs.astro.build/en/guides/environment-variables/#default-environment-variables
Would you mind telling what i need to write where? It took me a lot of time to just make the landing lage working, without guidance i would be lost for many more hours?
A much simpler way to get started is to use a dedicated domain, so you don't have to put it under a subpath.
If you have a domain, you can CNAME it to github pages: https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site
OR, you can rename your repository to <user>.github.io and use that domain without a base path. https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages#types-of-github-pages-sites
If you want to add base path to your project, as an example, you would change this line to something like this (untested but I think it should work):
- <a href={`/posts/${post.slug}/`} class="cactus-link" rel="prefetch">
+ <a href={`${import.meta.env.BASE_URL}/posts/${post.slug}/`} class="cactus-link" rel="prefetch">
Expected ")" but found "{"