satnaing / astro-paper

A minimal, accessible and SEO-friendly Astro blog theme
https://astro-paper.pages.dev/
MIT License
2.13k stars 440 forks source link

fix: update back button to redirect to home when no route history #241

Closed satnaing closed 5 months ago

satnaing commented 5 months ago

Description

Update back button in PostDetails.astro to redirect to home page when there's no route history. If a blog post url is pasted in the browser and there's no route history, prior to this commit, back button did not work as expected. Now, if there's somewhere to go back, the back button will go back to the previous route. If not, the back button will redirect to home page.

Before

https://github.com/satnaing/astro-paper/assets/53733092/a4bfa96d-4d4b-4c39-b827-ce8072a0e1f5

After

https://github.com/satnaing/astro-paper/assets/53733092/098f6c0b-7e9b-4bd1-b032-92444063d9df

Tested Browsers