@@ -43,7 +43,7 @@ export default ({ element, props }) => {
4343
4444 const { pageContext, location } = props
4545 const { intl } = pageContext
46- const { language, languages, redirect, routed } = intl
46+ const { language, languages, redirect, routed, originalPath } = intl
4747
4848 if ( typeof window !== "undefined" ) {
4949 window . ___gatsbyIntl = intl
@@ -52,7 +52,7 @@ export default ({ element, props }) => {
5252 const isRedirect = redirect && ! routed
5353
5454 if ( isRedirect ) {
55- const { pathname , search } = location
55+ const { search } = location
5656
5757 // Skip build, Browsers only
5858 if ( typeof window !== "undefined" ) {
@@ -68,7 +68,7 @@ export default ({ element, props }) => {
6868 }
6969
7070 const queryParams = search || ""
71- const newUrl = withPrefix ( `/${ detected } ${ pathname } ${ queryParams } ` )
71+ const newUrl = withPrefix ( `/${ detected } ${ originalPath } ${ queryParams } ` )
7272 window . localStorage . setItem ( "gatsby-intl-language" , detected )
7373 window . location . replace ( newUrl )
7474 }
0 commit comments