Skip to content

Harden last-updated dates: CI guard, SEO metadata, View history link - #904

Merged
braginini merged 5 commits into
mainfrom
last-updated-improvements
Aug 5, 2026
Merged

Harden last-updated dates: CI guard, SEO metadata, View history link#904
braginini merged 5 commits into
mainfrom
last-updated-improvements

Conversation

@TechHutTV

@TechHutTV TechHutTV commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Description

Builds on the git-based "Updated " system: a broken date pipeline now fails loudly in CI instead of silently shipping dateless pages, the dates now feed SEO freshness signals (meta, JSON-LD), and each page links to its GitHub commit history. Along the way this fixes two unrelated latent bugs: GitHub source links rendering on 404/500 pages, and npm run lint crashing under ESLint 9 with eslint-config-next 16.

Changes

Last-updated pipeline (scripts/generate-last-updated.mjs)

  • If no route receives a date (git history unavailable or shallow clone), the script fails the build under GITHUB_ACTIONS, where the workflow guarantees full history via fetch-depth: 0, so an empty map always means breakage.
  • Other environments only warn and build on. Vercel shallow-clones by design (--depth=10), so its builds ship without dates unless VERCEL_DEEP_CLONE=true is set on the project (see deployment notes).

SEO freshness metadata (src/pages/_app.jsx, mdx/rehype.mjs)

  • Pages with a known date emit <meta property="article:modified_time"> and a JSON-LD TechArticle block (headline, description, dateModified). Pages without a date (generated API resources, shallow-clone builds) emit nothing.
  • The date reaches _app.jsx through pageProps: the existing rehype date plugin exports lastUpdated from each compiled MDX module and recma-nextjs-static-props picks it up, the same mechanism title and sections already use. Each page carries only its own date, so nothing is added to the shared client bundle.

View history links (src/components/Layout.jsx, scripts/generate-github-routes.mjs)

  • New "View history" item in the right rail under "Edit on Github", linking to the page's commit history on GitHub, with the same index-route handling as the edit link.
  • Both GitHub links now render only on routes backed by a real MDX file, via a new generated MDX_PAGE_ROUTES set. Previously the prerendered 404/500 pages linked to the nonexistent src/pages/_error.mdx (surfaced by an external audit; the Edit link already had this bug).

ESLint 9 fix (eslint.config.mjs)

  • eslint-config-next 16 ships core-web-vitals as a native flat config; loading it through FlatCompat crashed ESLint with "Converting circular structure to JSON". The config now imports and spreads it directly.
  • With the config actually loading, ESLint reports 23 pre-existing findings (15 errors, 8 warnings), mostly from the stricter react-hooks v6 rules. Left for a follow-up; the two rules-of-hooks errors deserve a look first.
  • @eslint/eslintrc in devDependencies is now unused and can be dropped in a follow-up (needs a lockfile regen).

Deployment notes

  • GitHub Actions → Docker production path needs nothing: full history is already fetched and the dates bake into the static HTML.
  • Vercel deployments need the VERCEL_DEEP_CLONE=true environment variable for dates, SEO metadata, and sitemap <lastmod> to appear. Confirmed working in the Preview environment on 2026-08-05. Without it, builds succeed but ship dateless.

Validation

  • npm run build passes; npm run lint runs again (crash gone).
  • Guard tested in all three modes: GitHub Actions sim fails with exit 1, Vercel-like CI=1 warns and exits 0, normal run generates 287 dated routes.
  • Built HTML verified: content pages carry the meta tag, JSON-LD, and both GitHub links; 404.html/500.html contain no GitHub source links; index routes still resolve to .../index.mdx.
  • Verified per-page props: each page's __NEXT_DATA__ contains only its own lastUpdated, and no client chunk contains the route-to-date map.
  • Verified live on a Vercel preview with VERCEL_DEEP_CLONE=true: Updated dates render and sitemap <lastmod> tags are present.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 5, 2026 4:03pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@TechHutTV, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fe450e68-1fe2-4b66-9109-61d5fb802c4c

📥 Commits

Reviewing files that changed from the base of the PR and between b5ec205 and 1ddbc13.

📒 Files selected for processing (1)
  • src/components/Layout.jsx
📝 Walkthrough

Walkthrough

The route generator now records all MDX-backed routes. The layout restricts GitHub links to those routes and adds history links. The MDX transform exports update dates, which the app uses for page metadata. CI validates empty update maps.

Changes

MDX documentation flow

Layer / File(s) Summary
MDX route export generation
scripts/generate-github-routes.mjs, src/lib/edit-on-github-routes.js
The generator scans all .mdx files and emits EDIT_ON_GITHUB_INDEX_ROUTES plus non-root MDX_PAGE_ROUTES.
MDX-only GitHub links
src/components/Layout.jsx
The layout renders edit and history links for MDX routes. It selects index.mdx or the route-specific .mdx file.
Route update metadata and validation
mdx/rehype.mjs, scripts/generate-last-updated.mjs, src/pages/_app.jsx, eslint.config.mjs
The MDX transform exports update dates. Empty date maps fail in CI and warn locally. Available timestamps populate article:modified_time and TechArticle metadata. ESLint now imports the Next.js core web-vitals configuration directly.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MDXTransform as rehypeInsertLastUpdated
  participant AppInner
  participant Layout
  participant GitHub

  MDXTransform->>AppInner: Export lastUpdated
  AppInner->>AppInner: Add modification metadata
  AppInner->>Layout: Render page
  Layout->>Layout: Check MDX_PAGE_ROUTES
  Layout-->>GitHub: Link to MDX source and commit history
Loading

Poem

A rabbit scans each MDX trail,
Adds dates where pages prevail.
Edit and history links appear,
Metadata now stays clear.
CI checks the map with care.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main changes: hardening last-updated date generation with CI validation, adding SEO metadata, and introducing a View history link.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch last-updated-improvements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Layout.jsx`:
- Line 239: Update the user-visible text in the Edit on Github link within the
Layout component to use the official “GitHub” capitalization, leaving the
surrounding link structure unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0015e97-eee1-44fd-a9bb-b1af3a1d00be

📥 Commits

Reviewing files that changed from the base of the PR and between d77631a and 1ab92a4.

📒 Files selected for processing (4)
  • scripts/generate-github-routes.mjs
  • scripts/generate-last-updated.mjs
  • src/components/Layout.jsx
  • src/pages/_app.jsx

Comment thread src/components/Layout.jsx Outdated
@braginini
braginini merged commit a51653a into main Aug 5, 2026
5 checks passed
@braginini
braginini deleted the last-updated-improvements branch August 5, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants