getgrav / grav-plugin-langswitcher

Grav LangSwitcher Plugin
https://getgrav.org
MIT License
28 stars 26 forks source link

using page's override default_route instead of raw_route #35

Closed lpaulger closed 2 years ago

lpaulger commented 6 years ago

I've encountered a scenario that the langswitcher isn't handling as I would expect.

I have my blog under the directory /knowledge/blog but I have the default route overridden with /blog.

screen shot 2018-03-28 at 12 22 34 screen shot 2018-03-28 at 12 23 29

grav itself has no issue when routing to the underlying blog pages, or the blog itself. But when I am on a blog page and use the langswitcher because it is using the rawRoute it includes the folder structure instead of using the overridden default route

I've been digging around the code a bit and I think in order to make this work, the grav library would need to expose the default_route override so that we could make use of it in the langswitcher plugin.

The reason I'm looking to address this is for SEO purposes, we don't want to have the /knowledge/blog url showing up at all.

lpaulger commented 6 years ago

I realize it might make more sense to override the Canonical route since this is public, and we want to use it in two places.

would it be fair to do a check for routeCanonical before using rawRoute ?

rhukster commented 2 years ago

Latest version uses full URL that should match any other reference to the page.