File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 11[build ]
22 publish = " .next"
3- command = " npm run build"
3+ # Use DEPLOY_PRIME_URL for previews, fallback to production URL
4+ command = " NEXT_PUBLIC_SITE_URL=${DEPLOY_PRIME_URL:-https://xarray.dev} npm run build"
45
56[build .environment ]
67 NODE_VERSION = " 20"
1718 to = " /404.html"
1819 status = 404
1920
20- # Environment variables for different deploy contexts
21- # Note: Netlify automatically provides URL and DEPLOY_PRIME_URL
22- # We don't need to set NEXT_PUBLIC_SITE_URL for previews since our code falls back to process.env.URL
23- [context .production .environment ]
24- NEXT_PUBLIC_SITE_URL = " https://xarray.dev"
21+ # Environment variables set via build command above
22+ # DEPLOY_PRIME_URL is automatically provided by Netlify
2523
2624# Headers for security
2725[[headers ]]
Original file line number Diff line number Diff line change @@ -39,10 +39,8 @@ export const Layout = ({
3939 // </Link>
4040 //)
4141
42- // Determine the base URL based on the environment
43- const baseUrl = process . env . NEXT_PUBLIC_SITE_URL
44- ? process . env . NEXT_PUBLIC_SITE_URL
45- : process . env . URL || 'http://localhost:3000'
42+ // Base URL is set via build command (DEPLOY_PRIME_URL for previews, production URL otherwise)
43+ const baseUrl = process . env . NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'
4644
4745 // Canonical URL always points to production for SEO
4846 const canonicalBaseUrl = 'https://xarray.dev'
@@ -52,7 +50,7 @@ export const Layout = ({
5250
5351 // Construct the full card URL
5452 const fullCardUrl = card . startsWith ( 'http' ) ? card : `${ baseUrl } ${ card } `
55- // Construct the full URL for og:url (can use preview URL)
53+ // Construct the full URL for og:url (uses preview URL in previews, production in prod )
5654 const fullUrl = url . startsWith ( 'http' ) ? url : `${ baseUrl } ${ url } `
5755
5856 return (
You can’t perform that action at this time.
0 commit comments