diff --git a/src/project/types/website/listing/website-listing-read.ts b/src/project/types/website/listing/website-listing-read.ts index c8aacd50096..05b8ff153c4 100644 --- a/src/project/types/website/listing/website-listing-read.ts +++ b/src/project/types/website/listing/website-listing-read.ts @@ -393,14 +393,16 @@ export function completeListingItems( debug(`[listing] Processing image match`); const progressive = imgMatch[1] === "true"; const imgHeight = imgMatch[2]; - const listingId = imgMatch[3]; - const docRelativePath = imgMatch[4]; + const lazy = imgMatch[3] !== "false"; + const listingId = imgMatch[4]; + const docRelativePath = imgMatch[5]; const docAbsPath = join(projectOutputDir(context), docRelativePath); const imgPlaceholder = imagePlaceholder( listingId, docRelativePath, progressive, imgHeight, + lazy, ); debug(`[listing] ${docAbsPath}`); debug(`[listing] ${imgPlaceholder}`); @@ -435,6 +437,7 @@ export function completeListingItems( }, progressive, imgHeight, + lazy, ); debug(`[listing] replacing: ${docAbsPath}`); @@ -454,7 +457,7 @@ export function completeListingItems( }; fileContents = fileContents.replace( imgPlaceholder, - imageSrc(imagePreview, progressive, imgHeight), + imageSrc(imagePreview, progressive, imgHeight, lazy), ); } else { debug(`[listing] using empty div: ${docAbsPath}`); @@ -501,11 +504,14 @@ export function imagePlaceholder( file: string, progressive: boolean, height?: string, + lazy?: boolean, ): string { return file ? `` + }, height=${height ? height : ""}, lazy=${ + lazy === false ? "false" : "true" + }]:${id}:${file} -->` : ""; } @@ -517,7 +523,7 @@ const descriptionPlaceholderRegex = //; const imagePlaceholderRegex = - //; + //; function hydrateListing( format: Format, @@ -1202,8 +1208,14 @@ async function listItemFromFile( } } -function imageSrc(image: PreviewImage, progressive: boolean, height?: string) { - return `
{
const pageSize = listing[kPageSize];
return imagePlaceholder(
@@ -454,6 +455,7 @@ export function reshapeListing(
itemPath,
itemNumber > pageSize,
listing[kImageHeight] as string,
+ lazy,
);
};
diff --git a/src/resources/projects/website/listing/item-default.ejs.md b/src/resources/projects/website/listing/item-default.ejs.md
index 91114a7867f..823f32c18d3 100644
--- a/src/resources/projects/website/listing/item-default.ejs.md
+++ b/src/resources/projects/website/listing/item-default.ejs.md
@@ -45,7 +45,7 @@ print(`