You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there something you don't understand? What is it? Describe it.
If I wan't to force URL's to have a trailing slash it won't work for any dynamic routes. During the client-side router resolution the trailing slash will always be removed if the URL is a dynamic route which is resolved using url/mapUrl and url/mapFallbackUrl.
I can't explain this behavior to myself. If I set the desired URL as "static" route or even test it in a clean Vue sandbox-application it is working with a trailing slash either – but the in the VSF the beforeEach router guard and the RouterManager seems to cause this behavior. Is there an explanation for that?
Why is it useful?
If you switch a domain/website to the new PWA it might be necessary to stick to the existing URL structure. For example if you use GoogleAnalytics tracking which will report wrong metrics because the entry-points aren't the same as before when the / is removed. This might not be a common problem but can have a huge impact when your conversion-analytics-data relies on such details.
How to test?
For example:
Call a dynamic url like: https://www.sampleshop.com/de/sample-category/
– in our example this url-path should target a route like { name: 'category', params: { slug: 'sample-category' }}
The desired category page should appear as planned
At the end of the client-side loading process the trailing slash disappears in the address bar
Unless you don't using the vue-router strict-mode you should be able to enter an URL using a / at the end or not. This is working so far – but on client-side rendering the slash disappears at the end.
I'm not even sure if this causes some relevant trouble for SEO but the (for me) unreasonable behavior is bothering me.
Any explanation and help is appreciated :)
The text was updated successfully, but these errors were encountered:
In beforeEach we normalize path which removes trailing slash const path = normalizeUrlPath(to.path)
then in processDynamicRoute/prepareDynamicRoute we replace path in route data with new without trailing slash.
We should change that. Maybe by using routeData.path instead of normalized path
following the opening of this issue (vuestorefront#4684) I created a configuration ( urlTrailingSlash ) to add or not the slash at the end of a url.
I changed the normalizeUrlPath function so that depending on the configuration the slash is added or not.
I also changed the prepareDynamicRoute function and added the pathToRegexpOptions attribute with the strict option following the slash config. pathToRegexpOptions tells the vuejs router not to remove the slash.
Is there something you don't understand? What is it? Describe it.
If I wan't to force URL's to have a trailing slash it won't work for any dynamic routes. During the client-side router resolution the trailing slash will always be removed if the URL is a dynamic route which is resolved using
url/mapUrl
andurl/mapFallbackUrl
.I can't explain this behavior to myself. If I set the desired URL as "static" route or even test it in a clean Vue sandbox-application it is working with a trailing slash either – but the in the VSF the
beforeEach
router guard and theRouterManager
seems to cause this behavior. Is there an explanation for that?Why is it useful?
If you switch a domain/website to the new PWA it might be necessary to stick to the existing URL structure. For example if you use GoogleAnalytics tracking which will report wrong metrics because the entry-points aren't the same as before when the
/
is removed. This might not be a common problem but can have a huge impact when your conversion-analytics-data relies on such details.How to test?
For example:
https://www.sampleshop.com/de/sample-category/
– in our example this url-path should target a route like
{ name: 'category', params: { slug: 'sample-category' }}
Unless you don't using the
vue-router
strict-mode you should be able to enter an URL using a/
at the end or not. This is working so far – but on client-side rendering the slash disappears at the end.I'm not even sure if this causes some relevant trouble for SEO but the (for me) unreasonable behavior is bothering me.
Any explanation and help is appreciated :)
The text was updated successfully, but these errors were encountered: