Skip to content

Commit

Permalink
chore: update converter for info hub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mhaack committed Nov 23, 2023
1 parent 3e4b7ed commit da2ce82
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tools/importer/transformers/libraryHub.js
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;

0 comments on commit da2ce82

Please sign in to comment.