Skip to content

Commit

Permalink
add comment + better lint
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangohjw committed Dec 30, 2024
1 parent 670947f commit c7111cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/components/src/utils/getReferenceLinkHref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const convertReferenceLinks = (
return originalLink
}

const refPage = sitemapArray.find(
({ id, indexPageId }) => refPageId === id || refPageId === indexPageId,
)
const refPage = sitemapArray.find(({ id, indexPageId }) => {
// in the case of a folder with IndexPage,
// we must check both the folder's id and the IndexPage's id
return refPageId === id || refPageId === indexPageId
})

if (!refPage) {
return originalLink
Expand Down
7 changes: 5 additions & 2 deletions tooling/build/scripts/publishing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ async function main() {
resource.fullPermalink.endsWith(INDEX_PAGE_PERMALINK) &&
resource.type !== "RootPage"

const resourceConvertedPermalink = getConvertedPermalink(resource.fullPermalink)
const resourceConvertedPermalink =
getConvertedPermalink(resource.fullPermalink)

const idOfFolder = resources.find(
(item) => isIndexPage && item.fullPermalink === resourceConvertedPermalink,
(item) =>
isIndexPage &&
item.fullPermalink === resourceConvertedPermalink,
)?.id

const sitemapEntry: SitemapEntry = {
Expand Down

0 comments on commit c7111cd

Please sign in to comment.