Skip to content

Commit

Permalink
Direct Siblings of mappers should not cause that the mapped Antora fi…
Browse files Browse the repository at this point in the history
…le structure appears in the page tree again for that pages
  • Loading branch information
PacoVK committed Mar 6, 2024
1 parent 0ef2dfe commit 3f3ee64
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/service/PageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const buildPageStructure = async (
let mapper: PathMapper | undefined;
if (mappers) {
mapper = mappers.find((mapper) => {
return fileName.startsWith(mapper.path);
return Path.dirname(fileName).startsWith(mapper.path);
});
if (mapper) {
if (!currentObject[mapper.target]) {
Expand All @@ -89,6 +89,18 @@ const buildPageStructure = async (
parts = fileName
.replace(`${Path.normalize(mapper.path)}/`, "")
.split("/");
} else {
LOGGER.debug(
`No mapper found for ${fileName}, now checking if this page is a direct sibling of a mapper...`,
);
const mapper = mappers.find((mapper) => {
return path.dirname(fileName) === path.dirname(mapper.path);
});
if (mapper) {
parts = fileName
.replace(`${path.dirname(mapper.path)}/`, "")
.split("/");
}
}
}

Expand Down

0 comments on commit 3f3ee64

Please sign in to comment.