fix(seo): JSON-LD structured data and sitemap hostname#423
fix(seo): JSON-LD structured data and sitemap hostname#423gabitoesmiapodo wants to merge 2 commits intofix/performancefrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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-sitemaphostname viaPUBLIC_APP_URL(with a fallback). - Add
OrganizationandWebApplicationJSON-LD structured data toindex.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.
| Sitemap({ | ||
| hostname: 'https://dappbooster.dev', | ||
| hostname: process.env.PUBLIC_APP_URL ?? 'https://demo.dappbooster.dev', | ||
| }), |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Fixed: changed ?? to || in the previous round so an empty string falls through to the hardcoded default.
1664165 to
bd51b27
Compare
87c9de1 to
080d617
Compare
bd51b27 to
2332bcb
Compare
080d617 to
5957e47
Compare
There was a problem hiding this comment.
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/", |
There was a problem hiding this comment.
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).
| "url": "https://demo.dappbooster.dev/", | |
| "url": "/", |
There was a problem hiding this comment.
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.
2332bcb to
b1e43d7
Compare
5957e47 to
e8d3651
Compare
- 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.
b1e43d7 to
ba8c91b
Compare
e8d3651 to
d0c83c8
Compare
Summary
OrganizationandWebApplicationJSON-LD schemas toindex.htmlPUBLIC_APP_URLenv var (fallback:demo.dappbooster.dev)Test plan
pnpm testpasses