hellotham / hello-astro

Hello Astro is a multi purpose Astro starter theme written in Typescript, TailwindCSS and AlpineJS. It supports Markdown and MDX based pages and blog posts.
https://hellotham.github.io/hello-astro
MIT License
158 stars 55 forks source link

dev urls don't match prod urls due to trailing slashes #3

Closed gnublet closed 1 year ago

gnublet commented 1 year ago

As in this Issue, there may be a discrepancy in dev and prod URLs which may cause Google indexing to think the site has redirect issues.

We may need to switch URLs to new URL('./relative', Astro.url) according to https://docs.astro.build/en/reference/configuration-reference/#buildformat , in order to be consistent but I could be wrong.

Also, there seems to be some work going on with astrojs/sitemap https://github.com/withastro/astro/issues/5604 and https://github.com/withastro/astro/issues/5630 to fix this issue.

ChristineTham commented 1 year ago

Hi thanks for opening an issue.

Can you describe exactly where and in what context you are encountering an issue? Is it the generation of links in the pages, or the generation of the canonical URL in the head ie.

<link rel="canonical" href="[http://localhost:3000/hello-astro/](view-source:http://localhost:3000/hello-astro/)">

I have compared the results between yarn dev and yarn preview and they seem consistent, because I am generally generating a URL based on BASE_URL for example

const siteurl = new URL(import.meta.env.BASE_URL, Astro.url)
gnublet commented 1 year ago

First I want to say thanks for the beautiful template!

Actually, never mind. I can't reproduce the issue locally either. So I guess I'll close this.