summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/pages/post.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vhosts/blog/nuldoc-src/pages/post.ts')
-rw-r--r--vhosts/blog/nuldoc-src/pages/post.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/vhosts/blog/nuldoc-src/pages/post.ts b/vhosts/blog/nuldoc-src/pages/post.ts
index f7e53421..b5f954ea 100644
--- a/vhosts/blog/nuldoc-src/pages/post.ts
+++ b/vhosts/blog/nuldoc-src/pages/post.ts
@@ -18,7 +18,12 @@ export interface PostPage extends Page {
uuid: string;
}
-export function getPostCreatedDate(page: { revisions: Revision[] }): Date {
+export function getPostPublishedDate(page: { revisions: Revision[] }): Date {
+ for (const rev of page.revisions) {
+ if (!rev.isInternal) {
+ return rev.date;
+ }
+ }
return page.revisions[0].date;
}
@@ -26,6 +31,10 @@ export function getPostUpdatedDate(page: { revisions: Revision[] }): Date {
return page.revisions[page.revisions.length - 1].date;
}
+export function postHasAnyUpdates(page: { revisions: Revision[] }): boolean {
+ return 2 <= page.revisions.filter((rev) => !rev.isInternal).length;
+}
+
export async function generatePostPage(
doc: Document,
config: Config,
@@ -114,7 +123,7 @@ export async function generatePostPage(
const html = await pageLayout(
{
- metaCopyrightYear: getPostCreatedDate(doc).year,
+ metaCopyrightYear: getPostPublishedDate(doc).year,
metaDescription: doc.description,
metaKeywords: doc.tags.map((slug) => getTagLabel(config, slug)),
metaTitle: `${doc.title}|${config.blog.siteName}`,
@@ -139,7 +148,7 @@ export async function generatePostPage(
description: doc.description,
tags: doc.tags,
revisions: doc.revisions,
- published: getPostCreatedDate(doc),
+ published: getPostPublishedDate(doc),
updated: getPostUpdatedDate(doc),
uuid: doc.uuid,
};