I, unfortunately, failed to create a PR, the repo seems to require permission to push a new branch for me. But nevertheless, here is the problem description and my proposed solution:
Problem: getCanonicalPageId does not support non-latin page titles
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.
Description
I, unfortunately, failed to create a PR, the repo seems to require permission to push a new branch for me. But nevertheless, here is the problem description and my proposed solution:
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