From eeef71cd63ba9df25f9bc5fe4a8920d5141e6536 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 28 Dec 2023 15:04:08 -0800 Subject: [PATCH 1/2] Add async --- .eleventy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 712072a5..f9b63651 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -61,7 +61,7 @@ module.exports = function (eleventyConfig) { const FolderNamePages = "wordpress-pages"; let output = []; - collection.getAll().forEach((item) => { + collection.getAll().forEach(async (item) => { item.data.domain = 'innovation.ca.gov'; if (item.inputPath.includes(FolderNamePosts)) { item.outputPath = item.outputPath.replace(`/${FolderNamePosts}`, ""); From 426fc1952e61d5d076c3c5c22c7d0c550070062f Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 28 Dec 2023 15:18:45 -0800 Subject: [PATCH 2/2] Build fix progress --- .eleventy.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index f9b63651..e49f06b9 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -122,9 +122,15 @@ module.exports = function (eleventyConfig) { item.data.tags = jsonData.tags; // WordPress will lazy load everything and you have to put php code in your theme to override it. We don't want to lazy load our featuref image - item.template.frontMatter.content = item.template.frontMatter.content.replace('loading="lazy" class="cagov-featured-image','class="cagov-featured-image'); + //item.template.frontMatter.content = item.template.frontMatter.content.replace('loading="lazy" class="cagov-featured-image','class="cagov-featured-image'); - let html = item.template.frontMatter.content; + let html = await item.template.read().then(t => { + return t.content + }); + + // WordPress will lazy load everything and you have to put php code in your theme to override it. We don't want to lazy load our featuref image + html = html.replace('loading="lazy" class="cagov-featured-image','class="cagov-featured-image'); + // Temporary rewrite of feature card h2 tag to h1. This is fixed in newer version of Gutenberg blocks plugin still under review so can be deleted when this no longer comes through as h2 causing a11y test failures if (html.indexOf('cagov-featured-sidebar') > -1) { const {