aboutsummaryrefslogtreecommitdiffstats
path: root/feed/profile-page.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-22 08:42:47 -0700
committerAdam Soltys <[email protected]>2026-10-22 08:42:47 -0700
commitf3a3d88c7d5a86ae1fa06cf23932631eaa050151 (patch)
tree0f4322e7ec206150ca16c067fd7b698f70705ec9 /feed/profile-page.js
parent743011c02300ef884333d41c87a88900173023c9 (diff)
downloadcoinosv3-f3a3d88c7d5a86ae1fa06cf23932631eaa050151.tar.gz
coinosv3-f3a3d88c7d5a86ae1fa06cf23932631eaa050151.zip
Links to coinos unfurl with a share card: site-wide Open Graph/Twitter tags and a 1200×630 og-image.png. Note and profile pages swap the site's tags for their own and fall back to the card when they have no picture. README links coinosv3-server on gittr.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'feed/profile-page.js')
-rw-r--r--feed/profile-page.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/feed/profile-page.js b/feed/profile-page.js
index a30c2ab..623dc09 100644
--- a/feed/profile-page.js
+++ b/feed/profile-page.js
@@ -11,7 +11,7 @@
// page goes out (and the build carries on into the cache).
import { decode } from 'nostr-tools/nip19';
import { verifyEvent } from 'nostr-tools/pure';
-import { NOTE_RELAYS, esc, scriptJson } from './note-page.js';
+import { NOTE_RELAYS, esc, scriptJson, siteTagsOut, siteImage } from './note-page.js';
export const PROFILE_PATH = /^\/((?:npub1|nprofile1)[a-z0-9]+|[A-Za-z0-9._-]{1,30})\/?$/;
// single-segment app routes and files that are never a person
@@ -186,14 +186,14 @@ export function renderProfilePage(html, data, ref, origin) {
desc ? `<meta property="og:description" content="${esc(desc)}">` : '',
desc ? `<meta name="description" content="${esc(desc)}">` : '',
origin ? `<meta property="og:url" content="${esc(origin + '/' + ref.path)}">` : '',
- picture ? `<meta property="og:image" content="${esc(picture)}">` : '',
- `<meta name="twitter:card" content="summary">`,
+ picture || siteImage(origin) ? `<meta property="og:image" content="${esc(picture || siteImage(origin))}">` : '',
+ `<meta name="twitter:card" content="${picture ? 'summary' : 'summary_large_image'}">`,
// the face and the cover start downloading with the page
picture ? `<link rel="preload" as="image" href="${esc(picture)}">` : '',
banner ? `<link rel="preload" as="image" href="${esc(banner)}">` : '',
`<script type="application/json" id="boot-profile">${scriptJson({ ...data, path: ref.path })}</script>`,
].filter(Boolean).join('\n');
- let out = html.replace(/<title>[^<]*<\/title>/i, `<title>${esc(title)}</title>`);
+ let out = siteTagsOut(html).replace(/<title>[^<]*<\/title>/i, `<title>${esc(title)}</title>`);
out = out.includes('</head>') ? out.replace('</head>', head + '\n</head>') : head + out;
return out;
}