From ba0a0781bf4dfd1e679e893cf16b6d09eca7968f Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Sat, 10 Aug 2024 13:38:57 +0530 Subject: [PATCH 1/2] feat: last updated. --- src/markdoc/layouts/Post.svelte | 14 ++++++++++++++ src/routes/blog/+page.ts | 1 + src/routes/blog/content.ts | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/markdoc/layouts/Post.svelte b/src/markdoc/layouts/Post.svelte index 87cb47397b..f891372119 100644 --- a/src/markdoc/layouts/Post.svelte +++ b/src/markdoc/layouts/Post.svelte @@ -19,6 +19,7 @@ export let timeToRead: string; export let cover: string; export let category: string; + export let lastUpdated: string; const authors = getContext('authors'); const authorData = authors.find((a) => a.slug === author); @@ -231,6 +232,15 @@ {/if}
+ {#if lastUpdated} + + Updated: + + + {/if} +
@@ -315,4 +325,8 @@ font-size: 24px; } } + + .last-updated-text { + color: var(--primary, #e4e4e7); + } diff --git a/src/routes/blog/+page.ts b/src/routes/blog/+page.ts index 3540570407..e8b5667745 100644 --- a/src/routes/blog/+page.ts +++ b/src/routes/blog/+page.ts @@ -23,6 +23,7 @@ export function load() { description: frontmatter.description, featured: frontmatter?.featured ?? false, date: new Date(frontmatter.date), + lastUpdated: new Date(frontmatter.lastUpdated), cover: frontmatter.cover, timeToRead: frontmatter.timeToRead, author: frontmatter.author, diff --git a/src/routes/blog/content.ts b/src/routes/blog/content.ts index daa1f6d70e..e8fa3e0be4 100644 --- a/src/routes/blog/content.ts +++ b/src/routes/blog/content.ts @@ -20,6 +20,7 @@ export type PostsData = { title: string; description: string; date: Date; + lastUpdated: Date; cover: string; timeToRead: number; author: string; @@ -51,6 +52,7 @@ export const posts = Object.entries(postsGlob) title: frontmatter.title, description: frontmatter.description, date: new Date(frontmatter.date), + lastUpdated: new Date(frontmatter.lastUpdated), cover: frontmatter.cover, timeToRead: frontmatter.timeToRead, author: frontmatter.author, From 165e18f1ffbf7ef2b5cbfff9370f004c01166c24 Mon Sep 17 00:00:00 2001 From: ItzNotABug Date: Sat, 10 Aug 2024 14:03:01 +0530 Subject: [PATCH 2/2] add: sample page with last updated flag for preview [THIS WILL BE REMOVED LATER]. --- .../post/announcing-init-faster-smoother-better/+page.markdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/routes/blog/post/announcing-init-faster-smoother-better/+page.markdoc b/src/routes/blog/post/announcing-init-faster-smoother-better/+page.markdoc index 2d67277aad..a8ba6daf7a 100644 --- a/src/routes/blog/post/announcing-init-faster-smoother-better/+page.markdoc +++ b/src/routes/blog/post/announcing-init-faster-smoother-better/+page.markdoc @@ -3,6 +3,7 @@ layout: post title: "Announcing: A new Init. Faster. Smoother. Better." description: Init is about to begin, and we’re bringing you many new features and products to be excited about. Experience everything new with Appwrite during the week of August 19 to 23. date: 2024-08-07 +lastUpdated: 2024-08-10 cover: /images/blog/announcing-init-faster-smoother-better/init-cover.png timeToRead: 4 author: eldad-fux