fix: add transliteration module to support non-latin URLs #423
+4
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: getCanonicalPageId does not support non-latin page titles
Issue:
I am using [Notion.so](http://Notion.so) to run [FinUA.org](http://FinUA.org) website and currently it isb deployed with [super.so](http://super.so). I have been using nextjs-notion-starter-kit project for it (thank you).
As deployed the project to Vercel, I realized that there were quite a few browser warnings about the page due to generated page URLs (they looked broken).
the page behind it:
moreover, this page also had the same URL generated
/-
despite being a separate page, and clicking on it would lead to the first page.I have investigated it, and it seems that the problem was in the module https://github.com/transitive-bullshit/nextjs-notion-starter-kit/blob/main/lib/get-canonical-page-id.ts
I went to the module https://github.com/NotionX/react-notion-x/tree/master/packages/notion-utils
and copied https://github.com/NotionX/react-notion-x/blob/master/packages/notion-utils/src/get-canonical-page-id.ts module, the problem seemed to be
getCanonicalPageId
function, it only seemed to work for Latin symbolsnormalizeTitle(getBlockTitle(block, recordMap))
:I pulled the
normalizeTitle
function, and yes, it seems to be the caseSolution:
The one that worked for me was just replacing
normalizeTitle(getBlockTitle(block, recordMap))
withslugify
from the transliteration npm package.Notion Test Page ID
701245d6db8c413689d180e87269ee56