Skip to content

fix(seo): JSON-LD structured data and sitemap hostname#423

Open
gabitoesmiapodo wants to merge 2 commits intofix/performancefrom
fix/seo
Open

fix(seo): JSON-LD structured data and sitemap hostname#423
gabitoesmiapodo wants to merge 2 commits intofix/performancefrom
fix/seo

Conversation

@gabitoesmiapodo
Copy link
Collaborator

Summary

  • Add Organization and WebApplication JSON-LD schemas to index.html
  • Make sitemap hostname configurable via PUBLIC_APP_URL env var (fallback: demo.dappbooster.dev)

Test plan

  • pnpm test passes
  • Validate JSON-LD with Google Rich Results Test

Copilot AI review requested due to automatic review settings March 23, 2026 21:45
@vercel
Copy link

vercel bot commented Mar 23, 2026

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

Project Deployment Actions Updated (UTC)
components.dappbooster Ready Ready Preview, Comment Mar 24, 2026 0:05am
demo.dappbooster Ready Ready Preview Mar 24, 2026 0:05am
docs.dappbooster Ready Ready Preview, Comment Mar 24, 2026 0:05am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds SEO-related structured data and makes sitemap generation use a configurable base URL so deployments can emit correct absolute links.

Changes:

  • Configure vite-plugin-sitemap hostname via PUBLIC_APP_URL (with a fallback).
  • Add Organization and WebApplication JSON-LD structured data to index.html.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vite.config.ts Switch sitemap hostname to be driven by PUBLIC_APP_URL instead of a hardcoded domain.
index.html Embed JSON-LD schema definitions for richer search engine metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 16 to 18
Sitemap({
hostname: 'https://dappbooster.dev',
hostname: process.env.PUBLIC_APP_URL ?? 'https://demo.dappbooster.dev',
}),
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

process.env.PUBLIC_APP_URL ?? ... will treat the common empty-string value (see .env.example sets PUBLIC_APP_URL='') as a valid hostname, resulting in an empty hostname and an invalid sitemap. Also, relying on process.env here may miss values from Vite’s .env loading unless the variable is exported in the shell. Consider loading env via Vite’s loadEnv in defineConfig(({ mode }) => ...) and normalizing to a non-empty URL origin (e.g., trim + parse + fallback).

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed: changed ?? to || in the previous round so an empty string falls through to the hardcoded default.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
"@type": "WebApplication",
"name": "dAppBooster",
"url": "https://demo.dappbooster.dev/",
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The JSON-LD url values are hardcoded to bootnode.dev / demo.dappbooster.dev. If this app is deployed on a different hostname (now supported for the sitemap via PUBLIC_APP_URL), the structured data will advertise the wrong canonical URL. Consider deriving these URLs from the same configured base URL at build time (or otherwise ensuring they stay in sync with the deployment hostname).

Suggested change
"url": "https://demo.dappbooster.dev/",
"url": "/",

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not changing. JSON-LD @id and url values must be absolute IRIs — a relative / is invalid structured data. For a project template the static fallback URL is acceptable; deriving it from PUBLIC_APP_URL at build time is a future enhancement.

- Add Organization and WebApplication JSON-LD schemas to index.html
- Make sitemap hostname configurable via PUBLIC_APP_URL env var
  with fallback to demo.dappbooster.dev
?? only falls back on null/undefined; an empty string (the default in
.env.example) would pass through as the hostname and produce an invalid
sitemap. || also handles empty strings.
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