Comments (4)
I've fixed it, but I daresay it's a hacked solution.
I did 2 things.
- In
src/components/LocalizedLink.js
, I applied a starting slash to the Link path only when not using the default lang. This stops the multiple layers of e.g./pt/blog/pt/contato
:
const path = locales[locale].default
? to
: `/${locales[locale].path}${isIndex ? `` : `${to}`}`;
return <Link {...props} to={path} />;
- In
src/components/Languages/index.js
, I stopped the double slash bug when switching from EN version:
const singleSlashSlug = associatedUrls[lang].replace(/\/\//g,'/');
return lang === "en" ?
navigate(singleSlashSlug) :
navigate(`/${lang}${singleSlashSlug}`);
I'm not 100% sure this solution is worth a PR as there could be a different reason for why the path started with this odd behaviour. It'd be useful to know if this is a recent issue. And to know if the code currently published on netlify https://iceberg-gatsby-multilang.netlify.app/ is that from master.
Let me know what you think @diogorodrigues @iplanwebsites.
from iceberg-gatsby-multilang.
This is happening to me too. Maybe it's something that has only recently surfaced. It'd be great to hear if anyone has fixed it or hasn't had this problem.
from iceberg-gatsby-multilang.
I started deleting things around that I think I won't use and this bug happened.
from iceberg-gatsby-multilang.
I found out that removing the netlify plugin causes this bug, don't ask me why. The reason I'm deleting it is because I will deploy somewhere else and I won't use netlify cms.
from iceberg-gatsby-multilang.
Related Issues (9)
- Backend not working on live site hosted on Netlify HOT 3
- Blog post dates are rendered incorrectly. HOT 1
- Page not found when deploying to Netlify HOT 1
- Remove outdated and vulnerable package
- URL path shows wrong
- Paginated blog posts list routes to homepage when language is changed
- Third language breaks a lot of things HOT 1
- open an associated blogpost in other languages HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iceberg-gatsby-multilang.