1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 20:35:49 -04:00

freeze build timestamp via an environment variable

This commit is contained in:
2022-03-18 17:41:27 -04:00
parent 5912cd1356
commit f870c5c796
6 changed files with 20 additions and 6 deletions

View File

@@ -1,14 +1,21 @@
import { getServerSideSitemap } from "next-sitemap";
import { getAllNotes } from "../lib/helpers/parse-notes";
import { baseUrl } from "../lib/config";
import { RELEASE_DATE } from "../lib/config/constants";
import type { GetServerSideProps } from "next";
import type { ISitemapField } from "next-sitemap";
export const getServerSideProps: GetServerSideProps = async (context) => {
// TODO: make this not manual (serverless functions can't see filesystem at runtime)
const pages: ISitemapField[] = [
{ loc: "/", priority: 1.0, changefreq: "weekly" }, // homepage
{ loc: "/notes/", changefreq: "weekly" },
{
// homepage
loc: "/",
priority: 1.0,
changefreq: "weekly",
lastmod: RELEASE_DATE,
},
{ loc: "/notes/", changefreq: "weekly", lastmod: RELEASE_DATE },
{ loc: "/birthday/" },
{ loc: "/cli/" },
{ loc: "/contact/" },
@@ -28,7 +35,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
pages.push({
loc: `/notes/${note.slug}/`,
// pull lastMod from front matter date
lastmod: note.date,
lastmod: new Date(note.date).toISOString(),
priority: 0.7,
})
);