FluxML / fluxml.github.io

Flux Website
https://fluxml.ai
MIT License
20 stars 45 forks source link

Use relative folder paths instead of root paths to fix previews #154

Closed Saransh-cpp closed 1 year ago

Saransh-cpp commented 1 year ago

The complete website right now uses root paths to specify a link, which is messing with the PR previews. The current PR previews worked, but all the URLs redirected users to the original website. This should fix everything up as now Franklin will look in the relative folder instead of picking up the root folders.

This still does not fix blogposts and tutorialposts. This means that if you open up a blog inside of a PR preview, the URL will redirect you to the original website's blog. I don't quite understand how the URL for a particular blog/tutorial is specified within the codebase. The base blog and tutorials page work as expected. Maybe @darsnack can help!

Working demos -

PR Checklist

darsnack commented 1 year ago

GH won't let me comment but this line probably should be

links[i] = isnothing(externallink) ? ("../../" * url * "/") : externallink
darsnack commented 1 year ago

It's unfortunate that using prepath doesn't automate some of this for us. Basically this means that any links must always be relatively specified (which is a bit annoying).

Saransh-cpp commented 1 year ago

This should work now. The links posted above should be updated with this new change!

It's unfortunate that using prepath doesn't automate some of this for us. Basically this means that any links must always be relatively specified (which is a bit annoying).

Agreed, this is a bit painful. This was the absolute last fix that I tried locally. before this, I tried separating out previews and the website completely, breaking the nested structure, but it did not work. I also tried dynamically changing the base URL but no luck :(

darsnack commented 1 year ago

Thanks!