Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve slashing + base href behavior #842

Merged
merged 10 commits into from Dec 6, 2023
Merged

improve slashing + base href behavior #842

merged 10 commits into from Dec 6, 2023

Conversation

felixroos
Copy link
Collaborator

+ prefix sidebar links & mdx links with base
+ add trailing slashes
@felixroos
Copy link
Collaborator Author

added a few more fixes

there is still a problem with the fonts, which are loaded from index.css e.g. src: url('/fonts/teletext/EuropeanTeletext.ttf');

not sure how to get the base href in there.. might work with an api endpoint

@felixroos felixroos marked this pull request as ready for review December 6, 2023 21:02
@felixroos
Copy link
Collaborator Author

i guess I'll merge this as is, the font urls can be fixed in a separate PR. all the other problems should be fixed + it will hopefully give algolia a better next crawl

@felixroos felixroos merged commit d9f78e1 into main Dec 6, 2023
2 checks passed
@felixroos felixroos deleted the slashocalypse branch December 6, 2023 21:05
} else if (url.href.startsWith('/')) {
// any other relative url starting with /
// NOTE: this does strip off serialized queries and fragments
newHref += url.pathname.endsWith('/') ? url.pathname : url.pathname + '/';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed today that using url.pathname here does cause at least one tiny regression since it strips fragments off the ends of relative links (which I didn't think was an issue at first): in this excerpt from docs

You might now be able to see this properly here: [open in REPL](/#YXdhaXQgaW5pdEh5ZHJhKCkKbGV0IHBhdHRlcm4gPSAiMyA0IDUgWzYgN10qMiIKc2hhcGUoSChwYXR0ZXJuKSkub3V0KG8wKQpuKHBhdHRlcm4pLnNjYWxlKCJBOm1pbm9yIikucGlhbm8oKS5yb29tKDEpIA%3D%3D)

the fragment needs to stay. So I think quick rework of this to keep fragment is needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh darn, it's merged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I haven't noticed that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hotfixed by #845, thanks!

@felixroos
Copy link
Collaborator Author

that did the trick

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants