Skip to content

Commit

Permalink
Adjust sitemap revalidation length to force 7 days
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Oct 6, 2024
1 parent e2cceaa commit 63f2795
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/sitemap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {MetadataRoute} from "next"
import {getAllNodes} from "@lib/gql/gql-queries"

// https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
export const revalidate = false
export const revalidate = 25200
export const dynamic = "force-static"

const Sitemap = async (): Promise<MetadataRoute.Sitemap> => {
Expand All @@ -11,8 +11,9 @@ const Sitemap = async (): Promise<MetadataRoute.Sitemap> => {
const sitemap: MetadataRoute.Sitemap = []

nodes.map(node => {
const path = node.path === "/home" ? "/" : node.path
sitemap.push({
url: `https://sup.org${node.path}`,
url: `https://www.sup.org${path}`,
lastModified: new Date(node.changed.time),
priority: node.__typename === "NodeStanfordPage" ? 1 : 0.8,
changeFrequency: node.__typename === "NodeStanfordPage" ? "weekly" : "monthly",
Expand All @@ -21,7 +22,7 @@ const Sitemap = async (): Promise<MetadataRoute.Sitemap> => {
// Add excerpts page for each book as appropriate.
if (node.__typename === "NodeSupBook" && node.supBookExcerpts) {
sitemap.push({
url: `https://sup.org${node.path}/excerpts`,
url: `https://www.sup.org${node.path}/excerpts`,
lastModified: new Date(node.changed.time),
priority: 0.8,
changeFrequency: "monthly",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gql/gql-queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const getAllNodes = nextCache(
return nodes
}),
["node-paths"],
{revalidate: 60 * 60 * 7}
{revalidate: 25200}
)

/**
Expand Down

0 comments on commit 63f2795

Please sign in to comment.