Skip to content

Commit

Permalink
1st vers of blog article import with basic cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bohnertchris committed Nov 16, 2023
1 parent 4e49cda commit 135f4a6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tools/importer/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export default {
'div.loader-wrapper',
'div.cmp-page__skiptomaincontent',
'div#mainContent',
'div.page-header',
// Remove navigation from the beginning of blog entries as well as readmore-type teasers and blurb about 24petwatch at the end
'nav',
'div.imagelist',
'div.cmp-experiencefragment--blog-page-cta-component',
]);

// create the metadata block and append it to the main element
Expand Down
26 changes: 26 additions & 0 deletions tools/importer/transformers/blogBanner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function blogBanner(main, document) {

// Banner image is in mainContent element
const bannerImage = main.querySelector('#mainContent img');

if( bannerImage ){

// Create div to hold image
const div = document.createElement('div');
const img = document.createElement('img');
const imgSrc = bannerImage.getAttribute('src');
img.setAttribute('src', imgSrc);
div.append(img);

main.prepend(div);

}

// const p = document.createElement('p');
// p.textContent = 'Hello world!';
// main.append(p);


}

export default blogBanner;
4 changes: 3 additions & 1 deletion tools/importer/transformers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import createHeader from './header.js';
import createHero from './hero.js';
import createMetadata from './metadata.js';
import createBold from './bold.js';
import blogBanner from './blogBanner.js';

export const transformers = [
createBold,
createFullLayoutSection,
createHero,
blogBanner,
// createHero,
createHomepage,
createCards,
createFeatureImage,
Expand Down

0 comments on commit 135f4a6

Please sign in to comment.