generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update converter for info hub pages
- Loading branch information
Showing
1 changed file
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
/* global WebImporter */ | ||
const libraryHub = (main, document) => { | ||
const url = document.querySelector('[property="og:url"]')?.content; | ||
if (url?.endsWith('/library.html')) { | ||
main.querySelectorAll('div.container-sidebar').forEach((div) => div.remove()); | ||
main | ||
.querySelectorAll('div.aem-Grid.aem-Grid--12.aem-Grid--default--12 h2') | ||
.forEach((h2) => h2.closest('div').remove()); | ||
|
||
const block = [['Card List (library)'], ['']]; | ||
const table = WebImporter.DOMUtils.createTable(block, document); | ||
main.append(table); | ||
if (url?.endsWith('/us/en/library.html') || url?.endsWith('/us/en/info.html')) { | ||
const pageNameMatch = url.match(/\/([^/]+)\.html$/); | ||
if (pageNameMatch) { | ||
const pageName = pageNameMatch[1]; | ||
main.querySelectorAll('div.container-sidebar').forEach((div) => div.remove()); | ||
main | ||
.querySelectorAll('div.aem-Grid.aem-Grid--12.aem-Grid--default--12 h2') | ||
.forEach((h2) => h2.closest('div').remove()); | ||
const block = [[`Card List (${pageName})`], ['']]; | ||
const table = WebImporter.DOMUtils.createTable(block, document); | ||
main.append(table); | ||
} | ||
} | ||
}; | ||
export default libraryHub; |