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
As a developer using Swiper I want to have the flexibility to use or not the key parameter on History navigation module so that will prevent to have undesired slashes (/) on the resulting URL.
Examples
In all the cases will have the following Swiper implementation:
When navigating through the slider, the resulting URL will be:
/slug//slide-2
/slug//slide-3
/slug//slide-n
...
Suggested solution
In module History navigation we could provide following implementation:
As you can see on this file (src/modules/history/history.js, line 56 to 62), when the new URL is being generated, the key param is always printing his value on the template string.
Clear and concise description of the problem
As a developer using Swiper I want to have the flexibility to use or not the
key
parameter onHistory navigation
module so that will prevent to have undesired slashes (/
) on the resulting URL.Examples
In all the cases will have the following Swiper implementation:
Case 1:
key
is set toundefined
Given the following configuration for the
History navigation
module:When navigating through the slider, the resulting URL will be:
/slug/undefined/slide-2
/slug/undefined/slide-3
/slug/undefined/slide-n
Case 2:
key
is set to empty string''
Given the following configuration for the
History navigation
module:When navigating through the slider, the resulting URL will be:
/slug//slide-2
/slug//slide-3
/slug//slide-n
Suggested solution
In module
History navigation
we could provide following implementation:As you can see on this file (
src/modules/history/history.js
, line 56 to 62), when the new URL is being generated, thekey
param is always printing his value on the template string.We can make it optional, for example with a ternary when printing the
key
value:By this way, taking into account the cases explained before, the result will be:
Case 1:
key
is set toundefined
/slug/slide-2
/slug/slide-3
/slug/slide-n
Case 2:
key
is set to empty string''
/slug/slide-2
/slug/slide-3
/slug/slide-n
Alternative
No response
Additional context
No response
Validations
Would you like to open a PR for this feature?
The text was updated successfully, but these errors were encountered: