feat(meta): add Open Graph and Twitter link-preview metadata - #456
Merged
Merged
Conversation
Set metadataBase to https://kn0.app so preview URLs are absolute, add openGraph and a summary_large_image twitter card, and a plain brand accent theme-color for Discord's embed side bar. Sharpen the page and manifest description, and keep the app name in one constant in the layout. The preview image follows once the #450 social card exists. Part of #451
Merged
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A kn0.app link pasted into Discord, Slack, X or LinkedIn gets a bare link today. The page metadata had no Open Graph or Twitter tags and no
metadataBase. This PR adds the metadata half of #451. The preview image comes in a follow-up, because it's exported from #450's social card and that artwork doesn't exist yet.app/layout.tsxmetadataBase: new URL('https://kn0.app')(matchespublic/CNAME), so the image URL added later comes out absolute.openGraph:type: 'website',siteName,title,description,url: '/',locale: 'en_US'.twitter: { card: 'summary_large_image' }. Next fillstwitter:titleandtwitter:descriptionfrom the Open Graph fields, so they aren't repeated.viewport.themeColor: '#4f8ef7'(dark-theme--accent). This is a plaintheme-colorwith nomediaattribute, which Discord uses to color the embed's side bar. A comment asks feat(pwa): make the app installable as a desktop app #446 to keep it as the first entry when it adds the per-scheme light and dark entries.APP_NAMEandAPP_DESCRIPTION), so a rename touches one line.public/manifest.webmanifest: now has the same description, so the install prompt and the link preview say the same thing.Verification
npm run build→out/index.htmlcontains:Lint, type-check, spell-check and build all pass. There's no visible UI change, so there are no screenshots, and no radio behavior is involved.
Still to do for #451 (after #450 lands)
app/opengraph-image.png(1200×630, well under 1 MB) withopengraph-image.alt.txt.og:image, its width, height and alt, and the X image will then appear automatically.repo-socialPNG under the repository's Settings → Social preview.Heads-up: a plain accent
theme-coloralso tints browser chrome in browsers that honor it, like Safari's tab bar and mobile Chrome. That's the trade-off the ticket chose to get the Discord accent.Issues
Type of Change
!-- Breaking change (fix or feature that would cause existingfunctionality to change)
feat-- New feature (non-breaking change which adds functionality)fix-- Bug fix (non-breaking change which fixes an issue)docs-- Additional or updated documentationstyle-- Code style changes (formatting, missing semi colons, etc)refactor-- Code refactorperf-- Performance improvementtest-- Tests (adding or updating tests)build-- Build system or external dependencies changesci-- Build configuration changechore-- Grunt tasksrevert-- Revert previous changes