TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 70 forks source link

Dont work if slug has special chars #189

Open vitorregisrr opened 4 years ago

vitorregisrr commented 4 years ago

Hey! After a long time debugging my app (an specific route don't work), i discovered that this plugin dont support special chars on url:

If the slug is ### /portfolio/aaa, the transition works perfect. If the slug is /portfolio/vidraçaria-são-pedro, the animation and and the scroll to top just bug and dont work.

What do you guys suggest to fix that?

vitorregisrr commented 4 years ago

The solution is simple to normalize the slug, like that:


createNodeField({
      node,
      name: 'slug',
      value: `/blog/${slug.slice(12).normalize("NFD").replace(/[\u0300-\u036f]/g, "")}`
})
zhangyu1818 commented 4 years ago

same question,i use Chinese slugs