Skip to content

Transliterating "Cyrillic" to "Latin" #306

Answered by timlrx
rsipakov asked this question in Q&A
Discussion options

You must be logged in to vote

I think the best way would probably be to use rewrites. It would look something like this:

module.exports = {
  async rewrites() {
    return [
      {
        source: "/ru/tags/дом",
        destination: "/ru/tags/dom",
        locale: false,
      },
    ]
  },
}

The downside is that you would have to do this manually for each tag that you think needs to be converted.

An alternative approach would be to use middleware. With this, you could run CyrillicToTranslit on all paths coming from /ru/tags and redirect them. The downside is that you have to deploy it with the next.js server or on vercel. Have not actually tried the middleware feature myself, so I can't provide more advise beyond …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rsipakov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants