untra / polyglot

:abc: Multilingual and i18n support tool for Jekyll Blogs
https://polyglot.untra.io
MIT License
410 stars 59 forks source link

Anchor links broken? #149

Closed dougieh closed 2 years ago

dougieh commented 2 years ago

Are hrefs containing an #anchor link supported by polyglot relativization?

e.g. this works great and will correctly go to /about, /es/about, /fr/about etc.: <a href="/about">About</a>

But this will always route to the root of the site (/about) regardless of active language: <a href="/about#team">About</a>

I'm guessing the presence of the anchor hash mark breaks a regex somewhere?

untra commented 2 years ago

Hi @dougieh I just checked the site and tests, but I do not see any examples of relativizing anchor tags

https://polyglot.untra.io/2021/07/17/polyglot-1.5.0/#thanks https://polyglot.untra.io/es/2021/07/17/polyglot-1.5.0/#gracias

I'm guessing the presence of the anchor hash mark breaks a regex somewhere?

Yeah, I think it does indeed. :/ sorry about that.

heres that regex in question: https://github.com/untra/polyglot/blob/master/lib/jekyll/polyglot/patches/jekyll/site.rb#L178-L194

and the tests: https://github.com/untra/polyglot/blob/master/spec/jekyll/polyglot/patches/jekyll/site_spec.rb#L58-L140

good luck cowboy ðŸ¤