diff --git a/README.md b/README.md index 8ce07c53..573d6636 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,18 @@ If you bookmark something on nostr, Boris will show it in the bookmarks bar. If - If something looks empty, try opening another article and coming back — network data can arrive in bursts. - Not every article has highlights yet; they grow as the community reads. +## Development + +### Testing Open Graph Previews + +To manually test the Open Graph HTML preview for an article, append `?og=1` to any `/a/:naddr` URL: + +```text +https://read.withboris.com/a/?og=1 +``` + +This bypasses the normal SPA routing and serves the OG preview HTML directly, useful for verifying social media preview cards. + ## License MIT diff --git a/vercel.json b/vercel.json index fb4b78a1..30b864a1 100644 --- a/vercel.json +++ b/vercel.json @@ -11,7 +11,21 @@ "rewrites": [ { "source": "/a/:naddr", - "destination": "/api/article-og?naddr=:naddr" + "destination": "/api/article-og?naddr=:naddr", + "has": [ + { "type": "query", "key": "og", "value": "1" } + ] + }, + { + "source": "/a/:naddr", + "destination": "/api/article-og?naddr=:naddr", + "has": [ + { + "type": "header", + "key": "user-agent", + "value": ".*(bot|Bot|BOT|crawler|Crawler|CRAWLER|spider|Spider|facebookexternalhit|Slackbot|Twitterbot|LinkedInBot|WhatsApp|TelegramBot|Discordbot|Googlebot|bingbot|YandexBot|Baiduspider).*" + } + ] }, { "source": "/(.*)",