feat: Add Open Graph and Twitter meta tags, make the domain configurable, and use WebP for thumbnails.

This commit is contained in:
x
2026-01-24 23:34:38 +01:00
parent 0cc0e5aa02
commit 595118c2c8
3 changed files with 16 additions and 5 deletions

View File

@@ -173,7 +173,7 @@ export default {
success: true,
user: {
name: actitem.username,
channel: actitem.usernetwork == "Telegram" && actitem.userchannel !== "w0bm.com" ? "anonymous" : actitem.userchannel,
channel: actitem.usernetwork == "Telegram" && actitem.userchannel !== cfg.websrv.domain ? "anonymous" : actitem.userchannel,
network: actitem.usernetwork
},
item: {
@@ -182,7 +182,7 @@ export default {
long: actitem.src,
short: url.parse(actitem.src).hostname,
},
thumbnail: `${cfg.websrv.paths.thumbnails}/${actitem.id}.png`,
thumbnail: `${cfg.websrv.paths.thumbnails}/${actitem.id}.webp`,
coverart: coverart ? `${cfg.websrv.paths.coverarts}/${actitem.id}.webp` : '/s/img/music.webp',
dest: `${cfg.websrv.paths.images}/${actitem.dest}`,
mime: actitem.mime,
@@ -194,7 +194,7 @@ export default {
favorites: favorites,
tags: tags
},
title: `${actitem.id} - w0bm.com`,
title: `${actitem.id} - ${cfg.websrv.domain}`,
pagination: {
end: items[items.length - 1]?.id,
start: items[0]?.id,

View File

@@ -144,7 +144,8 @@ process.on('unhandledRejection', err => {
tpl.globals = {
lul: cfg.websrv.lul,
themes: cfg.websrv.themes,
modes: cfg.allowedModes
modes: cfg.allowedModes,
domain: cfg.websrv.domain || 'w0bm.com'
};
router.use(tpl);

View File

@@ -10,7 +10,17 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@if(typeof item !== 'undefined')
<link rel="canonical" href="https://w0bm.com/{{ item.id }}" />@endif
<link rel="canonical" href="https://{{ domain }}/{{ item.id }}" />
<meta property="og:site_name" content="f0bm" />
<meta property="og:title" content="f0bm - {{ item.id }}" />
<meta property="og:url" content="https://{{ domain }}/{{ item.id }}" />
<meta property="og:image" content="https://{{ domain }}{{ item.thumbnail }}" />
<meta property="og:type" content="website" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:title" content="f0bm - {{ item.id }}" />
<meta property="twitter:image" content="https://{{ domain }}{{ item.thumbnail }}" />
<meta property="twitter:url" content="https://{{ domain }}/{{ item.id }}" />
@endif
</head>
<body>