diff --git a/src/components/OutDatedCallOut.astro b/src/components/OutDatedCallOut.astro index 32a6743..ff09685 100644 --- a/src/components/OutDatedCallOut.astro +++ b/src/components/OutDatedCallOut.astro @@ -1,23 +1,14 @@ --- import Callout from "./shortcodes/Callout.astro" - -import { siteConfig } from "../config"; -const daysBeforeOutdated = siteConfig.outdatedCallout.daysBeforeOutdated || 90; - -const { lastUpdatedAt = '', noscript = false } = Astro.props +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) --- -{ ( !noscript && daysDelta >= daysBeforeOutdated ) && - - This article was updated {daysDelta} days ago. The content may be outdated. - -} -{ ( noscript && daysDelta >= daysBeforeOutdated ) && - - This article was updated a long time ago. The content may be outdated. - +{ 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 d419c72..d0fb3de 100644 --- a/src/config.ts +++ b/src/config.ts @@ -41,7 +41,7 @@ export const siteConfig = { // 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, // enable the outdated callout + enabled: true, daysBeforeOutdated: 90, // the number of days before the content is considered outdated, defaults to 90 days }, // encryption diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 4daf3e6..5b9b4e0 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -74,7 +74,7 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || ` { (cover && cover !== firstImageURL && cover !== `/blog/${slug}/featured.png`) && {`cover } {headings.length !== 0 && } {entry.data.summary &&

{entry.data.summary}

} - { siteConfig.outdatedCallout.enabled && (siteConfig.noClientJavaScript ? : )} +