diff --git a/astro.config.mjs b/astro.config.mjs
index 522c846d..11206db5 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -5,6 +5,7 @@ import { defineConfig } from 'astro/config';
import process_anchors from "./src/plugins/process_anchors";
import process_image_urls from './src/plugins/process_image_urls';
import table_row_headers from './src/plugins/table_row_headers';
+import { remarkModifiedTime } from './src/plugins/remark-modified-time.mjs';
const BASE_PATH = "/oasis-plus"
@@ -26,6 +27,7 @@ export default defineConfig({
base: process.env.BASEURL,
trailingSlash: 'always',
markdown: {
+ remarkPlugins: [remarkModifiedTime],
rehypePlugins: [
[table_row_headers, {}],
[process_anchors, {baseURL: process.env.BASEURL || '/'}],
diff --git a/federalist.json b/federalist.json
new file mode 100644
index 00000000..87cc366b
--- /dev/null
+++ b/federalist.json
@@ -0,0 +1,3 @@
+{
+ "fullClone": true
+}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 303c32c9..bb610562 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"@astrojs/sitemap": "^3.1.1",
"@uswds/uswds": "3.7.1",
"astro": "^4.4.11",
+ "dayjs": "^1.11.10",
"typescript": "^5.3.3",
"unist-util-visit": "^5.0.0"
},
@@ -3906,6 +3907,11 @@
"type": "^1.0.1"
}
},
+ "node_modules/dayjs": {
+ "version": "1.11.10",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
+ "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
+ },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
diff --git a/package.json b/package.json
index 95b10cb7..790a4e46 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,6 @@
"pa11y-ci:desktop": "pa11y-ci --config ./.pa11yci-desktop --sitemap http://localhost:4321/sitemap-0.xml --sitemap-find \"^https://www.gsa.gov/oasis-plus/\" --sitemap-replace \"http://localhost:4321/\"",
"pa11y-ci:mobile": "pa11y-ci --config ./.pa11yci-mobile --sitemap http://localhost:4321/sitemap-0.xml --sitemap-find \"^https://www.gsa.gov/oasis-plus/\" --sitemap-replace \"http://localhost:4321/\"",
"pa11y-ci:gh": "npx start-server-and-test serve http://localhost:4321 pa11y-ci"
-
},
"dependencies": {
"@astrojs/check": "^0.5.6",
@@ -24,6 +23,7 @@
"@astrojs/sitemap": "^3.1.1",
"@uswds/uswds": "3.7.1",
"astro": "^4.4.11",
+ "dayjs": "^1.11.10",
"typescript": "^5.3.3",
"unist-util-visit": "^5.0.0"
},
diff --git a/src/components/LastModified.astro b/src/components/LastModified.astro
new file mode 100644
index 00000000..3776e769
--- /dev/null
+++ b/src/components/LastModified.astro
@@ -0,0 +1,22 @@
+---
+const {last_modified} = Astro.props;
+import dayjs from "dayjs";
+import utc from "dayjs/plugin/utc";
+
+dayjs.extend(utc);
+
+const updateDate = dayjs(last_modified)
+ .utc()
+ .format("MMMM DD, YYYY");
+---
+
+ Last updated: {updateDate}
+
+
+
\ No newline at end of file
diff --git a/src/content/about/domains-labor-categories/naics-codes.mdx b/src/content/about/domains-labor-categories/naics-codes.mdx
index 340cf585..0d27cee8 100644
--- a/src/content/about/domains-labor-categories/naics-codes.mdx
+++ b/src/content/about/domains-labor-categories/naics-codes.mdx
@@ -3,6 +3,7 @@ title: NAICS codes by domain
description: "Each OASIS+ domain contains multiple North American Industry Classification System (NAICS) codes. Learn which NAICs codes crosswalk to each domain."
order: 3
is_child: true
+last_modified: "February 27, 2024"
---
import NAICSDomainTables from "@components/NAICSDomainTables.astro";
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro
index 82d14592..2da5c455 100644
--- a/src/layouts/BaseLayout.astro
+++ b/src/layouts/BaseLayout.astro
@@ -2,8 +2,9 @@
import GSAHeader from '@components/GSAHeader.astro';
import USAIdentifier from '@components/USAIdentifier.astro';
import Banner from '@components/Banner.astro';
+import LastModified from "@components/LastModified.astro"
-const { title, description, show_site_link} = Astro.props;
+const { title, description, show_site_link, last_modified} = Astro.props;
---
@@ -36,6 +37,7 @@ const { title, description, show_site_link} = Astro.props;
+ {last_modified && ( )}
diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro
index 2c24b2d2..2fe2f188 100644
--- a/src/layouts/PageLayout.astro
+++ b/src/layouts/PageLayout.astro
@@ -1,9 +1,9 @@
---
import BaseLayout from "@layouts/BaseLayout.astro";
-const { title, description } = Astro.props;
+const { title, description, last_modified } = Astro.props;
+
---
-
-
+
diff --git a/src/pages/about/[...slug].astro b/src/pages/about/[...slug].astro
index 5c1536ab..95cd7d50 100644
--- a/src/pages/about/[...slug].astro
+++ b/src/pages/about/[...slug].astro
@@ -14,9 +14,10 @@ export async function getStaticPaths() {
}
const { entry, pages } = Astro.props;
-const { Content, headings } = await entry.render();
+const { Content, headings, remarkPluginFrontmatter:{last_modified} } = await entry.render();
+
---
-
+
+
{entry.data.order == 0 ?
(
diff --git a/src/pages/contact.astro b/src/pages/contact.astro
index a404bdb9..7d10dfa7 100644
--- a/src/pages/contact.astro
+++ b/src/pages/contact.astro
@@ -5,10 +5,10 @@ import PageLayout from '@layouts/PageLayout.astro'
const entry = await getEntry('contact', 'index');
-const { Content} = await entry.render();
+const { Content, remarkPluginFrontmatter:{last_modified}} = await entry.render();
---
-
+
diff --git a/src/pages/events-training.astro b/src/pages/events-training.astro
index 1a78edfb..9437b578 100644
--- a/src/pages/events-training.astro
+++ b/src/pages/events-training.astro
@@ -5,10 +5,10 @@ import PageLayout from '@layouts/PageLayout.astro'
const entry = await getEntry('events-training', 'index');
-const { Content} = await entry.render();
+const { Content, remarkPluginFrontmatter:{last_modified}} = await entry.render();
---
-
+
diff --git a/src/pages/resources/index.astro b/src/pages/resources/index.astro
index b79ecd30..43cc3681 100644
--- a/src/pages/resources/index.astro
+++ b/src/pages/resources/index.astro
@@ -5,10 +5,10 @@ import PageLayout from '@layouts/PageLayout.astro'
const entry = await getEntry('resources', 'index');
-const { Content} = await entry.render();
+const { Content, remarkPluginFrontmatter:{last_modified} } = await entry.render();
---
-
+
diff --git a/src/pages/sellers-guide/[...slug].astro b/src/pages/sellers-guide/[...slug].astro
index 006894ea..8311fe9c 100644
--- a/src/pages/sellers-guide/[...slug].astro
+++ b/src/pages/sellers-guide/[...slug].astro
@@ -13,9 +13,9 @@ export async function getStaticPaths() {
})
}
const { entry, pages } = Astro.props;
-const { Content, headings } = await entry.render();
+const { Content, headings, remarkPluginFrontmatter:{last_modified} } = await entry.render();
---
-
+
{entry.data.order == 0 ?
(
diff --git a/src/plugins/remark-modified-time.mjs b/src/plugins/remark-modified-time.mjs
new file mode 100644
index 00000000..9ca7a784
--- /dev/null
+++ b/src/plugins/remark-modified-time.mjs
@@ -0,0 +1,29 @@
+/**
+ * This looks at the last git commit of the markdown files to determine the
+ * modification date.
+ *
+ * Alternatively users may override this date by adding a last_modified key to front-matter
+ * with the date as a string.
+ *
+ * When running on cloud.gov pages, it is important to tell cloud.gov to clone
+ * the full repo — the default is a shallow clone.
+ *
+ * This is specified in the root-level federalist.json file
+ * See: https://cloud.gov/pages/documentation/federalist-json/
+ */
+import { execSync } from "child_process";
+
+export function remarkModifiedTime() {
+ return function (tree, file) {
+ // allow content creators to override date in front-matter
+ const manual_last_modified_date = file.data.astro.frontmatter.last_modified
+ if (manual_last_modified_date) {
+ file.data.astro.frontmatter.last_modified = manual_last_modified_date
+ }
+ else {
+ const filepath = file.history[0];
+ const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`);
+ file.data.astro.frontmatter.last_modified = result.toString();
+ }
+ };
+}
\ No newline at end of file