microapps/gatsby-plugin-react-i18next

Respect Gatsby's `trailingSlash` option

bicstone opened this issue · 2 comments

trailingSlash option has been added by gatsby.

https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/#trailingslash
gatsbyjs/gatsby#34205

The current behavior is always add trailing slashes to each URL regardless of the trailingSlash option.

const createUrlWithLang = (lng: string) => {
const url = `${siteUrl}${lng === defaultLanguage ? '' : `/${lng}`}${originalPath}`;
return url.endsWith('/') ? url : `${url}/`;
};

Is it possible to be able to respect Gatsby's trailingSlash option and control the handling of trailing slashes?

#136

You'll have to add trailingSlash yourself to this plugin's options to match what you set it to in the gatsby config, but it will work.

@sklawren Thanks!