Skip to content

feat(seo): include active trade listings in the sitemap - #422

Open
Hey-Yetunde wants to merge 1 commit into
arflexx:mainfrom
Hey-Yetunde:feat/381-sitemap-trades
Open

Hey-Yetunde wants to merge 1 commit into
arflexx:mainfrom
Hey-Yetunde:feat/381-sitemap-trades

Conversation

@Hey-Yetunde

Copy link
Copy Markdown

Closes #381

Summary

frontend/app/sitemap.ts now fetches the active trade listings and appends their /trades/<id> URLs, so search engines can discover and index individual trade pages.

Changes (frontend/app/sitemap.ts)

  • sitemap() is now an async route handler that returns the static PUBLIC_ROUTES plus dynamic trade entries.
  • Trades are fetched from the public listing API (${NEXT_PUBLIC_API_URL ?? http://localhost:3001}/api/v1/trades?page=&limit=), the same endpoint the home page uses. Up to 5 pages × 100 are pulled for a bounded sitemap.
  • Only status === "Active" trades are included.
  • Each entry uses trade.updated_at as lastModified (/trades/<id>, changeFrequency: "daily", priority: 0.6).
  • ISR: export const revalidate = 900 (15 minutes) and the fetch carries next: { revalidate: 900 }, so the sitemap regenerates on each revalidation cycle.
  • Failure-safe: if the API is unreachable/returns a non-OK status, the sitemap degrades to the static routes instead of breaking the build.

Tests (frontend/app/lib/seo.test.ts)

  • Existing sitemap tests updated for the async handler.
  • New sitemap trade listings (Issue #381):
    • includes active trade URLs with lastmod from updated_at — asserts a dynamic /trades/trade-1 URL is present, that a Completed trade is excluded, and that lastModified equals the trade's updated_at.
    • degrades to static routes when the listing API fails — asserts the static / remains and no /trades/ entry is emitted.

Verification

  • npx jest app/lib/seo.test.ts → 16 passed.
  • npx tsc --noEmit → no errors in the changed files (3 pre-existing errors elsewhere).

@drips-wave

drips-wave Bot commented Sep 26, 2026

Copy link
Copy Markdown

@Hey-Yetunde Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[frontend] - app/sitemap.ts returns only hardcoded static URLs with no dynamic trade listing URLs missing SEO opportunities

1 participant