Skip to content

Commit

Permalink
[pages/slug,#525][xs]: fix sidebar links
Browse files Browse the repository at this point in the history
  • Loading branch information
olayway committed Jun 21, 2023
1 parent 9e42c0b commit 86e335b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pages/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ function capitalize(str: string) {
// we should generate a file with sitemap instead of computing it on the fly for each page
/* function addPageToGroup(page: MddbFile, sitemap: Array<NavGroup>) { */
function addPageToSitemap(page: any, sitemap: Array<NavGroup | NavItem>) {
const urlParts = page.url_path!.split("/").filter((part) => part);
const urlDecoded = decodeURI(page.url_path);
const urlParts = urlDecoded!.split("/").filter((part) => part);
// don't add home page to the sitemap
if (urlParts.length === 0) return;
// top level, root pages
Expand Down Expand Up @@ -154,7 +155,7 @@ function addPageToSitemap(page: any, sitemap: Array<NavGroup | NavItem>) {
.filter(isNavGroup)
.find(
(group) =>
group.path !== undefined && page.url_path.startsWith(group.path)
group.path !== undefined && decodeURI(page.url_path).startsWith(group.path)
);
if (!matchingGroup) {
const newGroup: NavGroup = {
Expand Down

0 comments on commit 86e335b

Please sign in to comment.