@zeropress/build-core 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeropress/build-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "Shared ZeroPress build core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@zeropress/slug-policy": "0.1.0",
|
|
37
|
-
"@zeropress/preview-data-validator": "0.6.
|
|
37
|
+
"@zeropress/preview-data-validator": "0.6.6",
|
|
38
38
|
"@zeropress/theme-validator": "0.6.5",
|
|
39
39
|
"highlight.js": "11.11.1",
|
|
40
40
|
"markdown-it": "14.2.0",
|
package/src/api/build-site.js
CHANGED
|
@@ -294,6 +294,7 @@ async function renderFrontPage(state, route) {
|
|
|
294
294
|
url: currentUrl,
|
|
295
295
|
title: page.title,
|
|
296
296
|
description: page.excerpt,
|
|
297
|
+
updatedAt: page.updated_at_iso,
|
|
297
298
|
includeInFeed: false,
|
|
298
299
|
includeInSitemap: !isDelistedDocument(page),
|
|
299
300
|
};
|
|
@@ -400,6 +401,7 @@ async function renderPage(state, page) {
|
|
|
400
401
|
url: currentUrl,
|
|
401
402
|
title: page.title,
|
|
402
403
|
description: page.excerpt,
|
|
404
|
+
updatedAt: page.updated_at_iso,
|
|
403
405
|
status: page.status,
|
|
404
406
|
includeInSitemap: page.omit_from_sitemap !== true && !isDelistedDocument(page),
|
|
405
407
|
});
|
|
@@ -508,6 +510,7 @@ function normalizePreviewData(previewData, options = {}) {
|
|
|
508
510
|
const featuredMedia = deriveManagedMedia(featuredImage, mediaRegistry, normalizedSite);
|
|
509
511
|
return {
|
|
510
512
|
...page,
|
|
513
|
+
...(page.updated_at_iso ? { updated_at_iso: normalizeIsoTimestamp(page.updated_at_iso) } : {}),
|
|
511
514
|
discoverability: normalizeDiscoverability(page.discoverability),
|
|
512
515
|
featured_image: featuredImage,
|
|
513
516
|
...(featuredMedia ? { featured_media: featuredMedia } : {}),
|
|
@@ -995,6 +998,8 @@ function buildCollectionPageSummary(page, frontPage) {
|
|
|
995
998
|
url: frontPage?.type === 'page' && frontPage.page_slug === page.slug ? '/' : page.url,
|
|
996
999
|
excerpt: page.excerpt || '',
|
|
997
1000
|
featured_image: page.featured_image || '',
|
|
1001
|
+
updated_at: page.updated_at || '',
|
|
1002
|
+
updated_at_iso: page.updated_at_iso || '',
|
|
998
1003
|
...(page.featured_media ? { featured_media: { ...page.featured_media } } : {}),
|
|
999
1004
|
meta: page.meta,
|
|
1000
1005
|
data: page.data,
|
|
@@ -1057,6 +1062,8 @@ function buildCollectionCursorItemSummary(item) {
|
|
|
1057
1062
|
url: item.url,
|
|
1058
1063
|
excerpt: item.excerpt || '',
|
|
1059
1064
|
featured_image: item.featured_image || '',
|
|
1065
|
+
updated_at: item.updated_at || '',
|
|
1066
|
+
updated_at_iso: item.updated_at_iso || '',
|
|
1060
1067
|
meta: item.meta,
|
|
1061
1068
|
data: item.data,
|
|
1062
1069
|
};
|
|
@@ -1389,6 +1396,7 @@ function preparePage(page, site) {
|
|
|
1389
1396
|
document_type: documentType,
|
|
1390
1397
|
html: renderedDocument.html,
|
|
1391
1398
|
toc: renderedDocument.toc,
|
|
1399
|
+
updated_at: page.updated_at_iso ? formatTimestamp(page.updated_at_iso, site) : '',
|
|
1392
1400
|
};
|
|
1393
1401
|
}
|
|
1394
1402
|
|
|
@@ -2633,7 +2641,7 @@ function buildSearchPageItem(page, url) {
|
|
|
2633
2641
|
categories: [],
|
|
2634
2642
|
tags: [],
|
|
2635
2643
|
published_at_iso: '',
|
|
2636
|
-
updated_at_iso:
|
|
2644
|
+
updated_at_iso: normalizeIsoTimestamp(page.updated_at_iso),
|
|
2637
2645
|
content_text: htmlToSearchText(page.html),
|
|
2638
2646
|
};
|
|
2639
2647
|
}
|
|
@@ -3073,6 +3081,7 @@ function buildSitemapXml(site, emitted, generatedAt, stylesheetHref = '') {
|
|
|
3073
3081
|
...(emitted.frontPage && emitted.frontPage.includeInSitemap !== false
|
|
3074
3082
|
? [{
|
|
3075
3083
|
url: emitted.frontPage.url,
|
|
3084
|
+
...(emitted.frontPage.updatedAt ? { lastmod: toDate(emitted.frontPage.updatedAt) } : {}),
|
|
3076
3085
|
changefreq: 'daily',
|
|
3077
3086
|
priority: 1.0,
|
|
3078
3087
|
}]
|
|
@@ -3094,6 +3103,7 @@ function buildSitemapXml(site, emitted, generatedAt, stylesheetHref = '') {
|
|
|
3094
3103
|
.filter((page) => page.includeInSitemap !== false)
|
|
3095
3104
|
.map((page) => ({
|
|
3096
3105
|
url: page.url,
|
|
3106
|
+
...(page.updatedAt ? { lastmod: toDate(page.updatedAt) } : {}),
|
|
3097
3107
|
changefreq: 'monthly',
|
|
3098
3108
|
priority: 0.7,
|
|
3099
3109
|
})),
|
|
@@ -49,7 +49,7 @@ function renderMarkdownDocument(content) {
|
|
|
49
49
|
function createMarkdownRenderer(toc) {
|
|
50
50
|
const markdown = new MarkdownIt({
|
|
51
51
|
html: true,
|
|
52
|
-
linkify:
|
|
52
|
+
linkify: false,
|
|
53
53
|
typographer: true,
|
|
54
54
|
breaks: true,
|
|
55
55
|
highlight(value, language) {
|
|
@@ -162,8 +162,10 @@ function markdownTaskLists(markdown) {
|
|
|
162
162
|
addTokenClass(listItemToken, 'task-list-item');
|
|
163
163
|
|
|
164
164
|
const checkboxToken = new state.Token('html_inline', '', 0);
|
|
165
|
-
const
|
|
166
|
-
|
|
165
|
+
const isChecked = markerMatch[1].toLowerCase() === 'x';
|
|
166
|
+
const checked = isChecked ? ' checked' : '';
|
|
167
|
+
const label = isChecked ? 'Completed task' : 'Incomplete task';
|
|
168
|
+
checkboxToken.content = `<input class="task-list-item-checkbox" type="checkbox"${checked} disabled aria-label="${label}"> `;
|
|
167
169
|
|
|
168
170
|
const strippedContent = token.content.slice(markerMatch[0].length);
|
|
169
171
|
token.content = strippedContent;
|
|
@@ -337,7 +339,7 @@ function sanitizeHtml(html) {
|
|
|
337
339
|
aside: new Set(['role', 'class', 'id']),
|
|
338
340
|
img: new Set(['src', 'srcset', 'sizes', 'alt', 'title', 'class', 'id', 'width', 'height', 'loading', 'decoding']),
|
|
339
341
|
iframe: new Set(['src', 'width', 'height', 'frameborder', 'allowfullscreen', 'class']),
|
|
340
|
-
input: new Set(['type', 'checked', 'disabled', 'class', 'id']),
|
|
342
|
+
input: new Set(['type', 'checked', 'disabled', 'class', 'id', 'aria-label']),
|
|
341
343
|
source: new Set(['src', 'srcset', 'sizes', 'type', 'media', 'width', 'height', 'class', 'id']),
|
|
342
344
|
'*': new Set(['class', 'id']),
|
|
343
345
|
};
|