diff --git a/src/components/OutDatedCallOut.astro b/src/components/OutDatedCallOut.astro
new file mode 100644
index 0000000..ff09685
--- /dev/null
+++ b/src/components/OutDatedCallOut.astro
@@ -0,0 +1,14 @@
+---
+import Callout from "./shortcodes/Callout.astro"
+const { lastUpdatedAt } = Astro.props
+const lastUpdated = new Date(lastUpdatedAt).getTime()
+const dateNow = new Date().getTime()
+const dateDelta = dateNow - lastUpdated
+const Day = 1000 * 60 * 60 * 24
+const daysDelta = Math.round(dateDelta / Day)
+---
+{ daysDelta >= 30 &&
+
+ This article was updated on {daysDelta} days ago. The content may be outdated.
+
+}
\ No newline at end of file
diff --git a/src/config.ts b/src/config.ts
index d7663b0..d0fb3de 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -37,6 +37,13 @@ export const siteConfig = {
listuuid: '3546fc35-fd75-4163-936a-114514191981', // the id of the list to subscribe to, can be found in the listmonk admin panel
}
},
+ // outdated callout
+ // enable the callout to notify users that the content maybe outdated, this will add a callout to the top of the article page,
+ // initialized by the server islands
+ outdatedCallout: {
+ enabled: true,
+ daysBeforeOutdated: 90, // the number of days before the content is considered outdated, defaults to 90 days
+ },
// encryption
// the global password to encrypt/decrypt the content, if set, all without specifying a password will be encrypted with this password
// To use an environment variable to set the password, replace the value with `import.meta.env.CONTENT_PASSWORD`
diff --git a/src/content/posts/outdated-test/index.md b/src/content/posts/outdated-test/index.md
new file mode 100644
index 0000000..21fffb7
--- /dev/null
+++ b/src/content/posts/outdated-test/index.md
@@ -0,0 +1,9 @@
+---
+title: 'the Origin of the Computer Science'
+description: 'A walkthrough of my current terminal configuration'
+date: '1970-01-01'
+updated: '2000-01-01'
+author:
+ - 'Wheatley'
+---
+The
\ No newline at end of file
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
index a4c5164..5b9b4e0 100644
--- a/src/pages/blog/[...slug].astro
+++ b/src/pages/blog/[...slug].astro
@@ -11,6 +11,7 @@ import AuthorInfo from "../../components/helper/authors/Info.astro";
import TableOfContents from "../../components/TableOfContents.astro";
import "katex/dist/katex.css"
import { getLangFromUrl, useTranslations, useTranslatedPath } from '../../i18n/utils';
+import OutDatedCallOut from "../../components/OutDatedCallOut.astro";
const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang);
@@ -34,10 +35,10 @@ const author = Array.isArray(entry.data.author) ? entry.data.author : (entry.dat
// Get Wordcount and Last Updated Date
const wordcount = remarkPluginFrontmatter.wordcount;
-const lastUpdated = remarkPluginFrontmatter.lastModified;
+const lastUpdated = entry.data.updated ? entry.data.updated : remarkPluginFrontmatter.lastModified;
const pubDate = new Date(entry.data.date).toISOString().split('T')[0]
-const lastUpdatedDate = entry.data.updated ? new Date(entry.data.updated).toISOString().split('T')[0] : new Date(lastUpdated).toISOString().split('T')[0];
+const lastUpdatedDate = new Date(lastUpdated).toISOString().split('T')[0]
// Get author data
const authorData = await Promise.all((author).map((singleAuthor) => getEntry(singleAuthor).then(authorEntry => authorEntry?.data)))
@@ -73,6 +74,7 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
{ (cover && cover !== firstImageURL && cover !== `/blog/${slug}/featured.png`) && }
{headings.length !== 0 && }
{entry.data.summary &&
{entry.data.summary}
}
+