Skip to content

Commit 0485a40

Browse files
committed
Improves Language selection JS to allow other folders (better logic moving forward)
1 parent 6639530 commit 0485a40

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

_includes/languages.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
count = opts.length;
2626

2727
for ( var i = 0; i < count; i++ ){
28-
if ( -1 === opts[ i ].value.indexOf( window.location.pathname ) ) {
29-
continue;
28+
// Only happens if you have language path on the start of the location.pathname
29+
if ( 0 === window.location.pathname.indexOf( opts[ i ].value ) ) {
30+
opts[ i ].setAttribute( 'selected', 'selected' );
3031
}
31-
32-
opts[ i ].setAttribute( 'selected', 'selected' );
3332
}
3433
} )();
3534
</script>

0 commit comments

Comments
 (0)