mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-28 20:55:47 -04:00
set lastmod date of /notes to most recent post's
This commit is contained in:
@@ -14,9 +14,8 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
url: "/",
|
||||
priority: 1.0,
|
||||
changefreq: EnumChangefreq.WEEKLY,
|
||||
lastmod: RELEASE_DATE,
|
||||
lastmod: RELEASE_DATE, // timestamp frozen when a new build is deployed
|
||||
},
|
||||
{ url: "/notes/", changefreq: EnumChangefreq.WEEKLY, lastmod: RELEASE_DATE },
|
||||
{ url: "/birthday/" },
|
||||
{ url: "/cli/" },
|
||||
{ url: "/contact/" },
|
||||
@@ -41,6 +40,15 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
})
|
||||
);
|
||||
|
||||
// set lastmod of /notes/ page to most recent post's date
|
||||
pages.push({
|
||||
url: "/notes/",
|
||||
lastmod: new Date(notes[0].date).toISOString(),
|
||||
});
|
||||
|
||||
// sort alphabetically by URL
|
||||
pages.sort((a, b) => (a.url < b.url ? -1 : 1));
|
||||
|
||||
// translate array of all pages to sitemap's stream
|
||||
pages.forEach((page) => {
|
||||
stream.write(page);
|
||||
|
||||
Reference in New Issue
Block a user