Brent Haskins / Applied AI
How this site's sitemap sets lastModified for blog posts
brenthaskins.com/app/sitemap.ts builds blog URLs from getAllBlogPosts(), setting lastModified to each file's filesystem mtime when available, otherwise to the post date at UTC midnight. Brent Haskins does not bulk-bump lastmod on deploy; only files that actually change should move.
This is a code-path explanation, not SEO folklore.
Source code behavior
app/sitemap.ts:
const blogRoutes = getAllBlogPosts().map((post) => ({
url: `${SITE_URL}${getBlogUrl(post.slug)}`,
lastModified:
post.fileModifiedAt ??
new Date(`${post.updated ?? post.date}T00:00:00.000Z`),
changeFrequency: "monthly",
priority: 0.9
}));
getAllBlogPosts in lib/blog.ts attaches fileModifiedAt from fs.statSync when reading each file.
Implications for editors
| Action | Expected sitemap effect |
|---|---|
New content/blog/....md | New URL; lastmod ≈ file creation time |
| Edit existing post body/frontmatter | lastmod bumps with save time |
| Redeploy without file changes | lastmod should stay same |
IndexNow is separate
After the automated workflow publishes a post, scripts/notify-indexing.ts can ping IndexNow for that URL. That is independent of lastmod. Manual publishes still benefit from deploy + sitemap refresh.
RSS lastBuildDate
app/feed.xml/route.ts computes lastBuildDate from the latest blog file mtime among posts. Another consistency signal—not a ranking guarantee.
What not to do on this repo
- Script that touches every markdown file to “refresh SEO”
- Set all posts to today’s date in frontmatter without content changes
Both confuse crawlers and break the honest mtime signal the code already uses.
Verify after changes
npm run build- Open
/sitemap.xmllocally or on production - Confirm edited post URL shows a recent lastModified
Brent Haskins — accurate sitemap values are part of maintaining this site, same as fixing broken internal links.
FAQ
Questions people ask about this topic.
What lastModified value do blog posts get in the sitemap?
For each post, sitemap uses post.fileModifiedAt from fs.stat when lib/blog.ts loaded the markdown file. If missing, it falls back to new Date of post.updated or post.date at T00:00:00.000Z. Blog routes use priority 0.9. Static routes and project routes use a fixed STATIC_ROUTE_LAST_MODIFIED constant in the same file.
Should you change sitemap lastmod on every deploy?
Not for URLs with unchanged content. Google documentation warns that inaccurate lastmod values across many URLs can reduce trust in sitemap signals. On this site, editing a markdown file updates mtime and thus lastmod on next build. New files add new URLs. Unchanged files should stay stable across deploys.
Sources