Skip to content

Commit

Permalink
[pages/...slug.tsx][xs]: fix sitemap links titles
Browse files Browse the repository at this point in the history
  • Loading branch information
olayway committed Jun 14, 2023
1 parent c1e62c0 commit 9749c08
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pages/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ function capitalize(str: string) {
return str.charAt(0).toUpperCase() + str.slice(1);
}

// TODO temporaty solution
// 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);
Expand Down Expand Up @@ -142,7 +144,7 @@ function addPageToSitemap(page: any, sitemap: Array<NavGroup | NavItem>) {
for (let level = 0; level <= nestingLevel; level++) {
if (level === nestingLevel) {
currArray.push({
name: urlParts[level],
name: page.metadata?.title || urlParts[level],
href: page.url_path,
});
continue;
Expand Down

0 comments on commit 9749c08

Please sign in to comment.