Repository navigation
Description
Add Open Graph meta tags so that a Workshop Walker link shows a preview card in Discord (and other sites that read Open Graph). Discord docs: https://docs.discord.com/developers/link-previews/overview#quick-start
Tags to add (no image):
<meta property="og:site_name" content="Workshop Walker">
<meta property="og:title" content="...">
<meta property="og:description" content="...">
<meta name="theme-color" content="#......">
<meta name="twitter:card" content="summary">Leave out og:image, og:image:width and og:image:height. Use summary for twitter:card, because summary_large_image needs an image.
The UI cannot do this alone. ui/src/routes/+layout.ts sets ssr = false, and ui/svelte.config.js uses adapter-static with fallback: 'index.html'. Thus every route gets the same empty shell, and the tags come only after the JS runs. The Discord crawler does not run JS, so tags in <svelte:head> have no effect.
Two levels of work:
- Static tags in
ui/src/app.html. The site name, a general title and description, and the theme colour. This is small and gives a card for every link. - Tags for each page, for
/app/{id}and/item/{item}. The backend must put them into the HTML. At this timesrc/web/mod.rsservesui/build/throughStaticDirwith.fallback("index.html"). Add a Salvo handler for these two routes in front ofStaticDir. The handler gets the app or item name and a short description, then puts the tags intoindex.htmlbefore it sends the page. Escape the values as HTML attributes. The item description comes from Steam, so use the plain text, not the BB output, and cut it to approximately 200 characters. If the lookup fails, send the static shell from step 1.
Make sure that the static tags from step 1 do not also appear on pages that get tags from step 2. Discord can choose the wrong pair.
Test with the Discord embed debugger or with curl -A "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)" on an app URL and an item URL.
Claude (AI) wrote this issue from a request by the maintainer. Check the details before you act on them.
Activity