feat(website): Add Open Graph and Twitter Card meta tags for social sharing#815
feat(website): Add Open Graph and Twitter Card meta tags for social sharing#815aaronpowell merged 1 commit intostagedfrom
Conversation
…haring - Add og:type, og:url, og:title, og:description, og:image, og:site_name meta tags - Add twitter:card, twitter:title, twitter:description, twitter:image meta tags - Add canonical URL link element - Use social-image.png for social preview image - Update document.title dynamically when modal opens/closes - Resolve resource titles from JSON data files instead of raw filenames - Handle skill/hook folder path mismatches for title lookup - Change title separator from '-' to '|' for consistency Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds social-sharing metadata (Open Graph + Twitter Card) to the Astro base layout and improves modal title handling so the browser tab title reflects the currently opened resource.
Changes:
- Added canonical link plus Open Graph and Twitter Card meta tags in the base layout (including a new social preview image URL).
- Updated the file modal to set/restore
document.titleand resolve human-friendly titles from generated JSON metadata. - Added a new
social-image.pngunderwebsite/public/images/for rich link previews.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| website/src/layouts/BaseLayout.astro | Adds canonical + OG/Twitter meta tags and updates the page title format to use ` |
| website/src/scripts/modal.ts | Dynamically updates/restores document.title and resolves modal titles from JSON metadata. |
| website/public/images/social-image.png | Adds a social preview image referenced by OG/Twitter meta tags. |
| plugin: "plugins.json", | ||
| }; | ||
|
|
There was a problem hiding this comment.
RESOURCE_TYPE_TO_JSON maps plugin -> plugins.json, but plugins.json items (generated by eng/generate-website-data.mjs) use name rather than title. As a result, resolveResourceTitle() can return undefined for plugins and briefly set title.textContent / document.title to undefined | Awesome GitHub Copilot when opening a plugin modal. Consider removing plugin from this lookup map (since openPluginModal() already sets the title), or special-casing plugins to read name (and updating the typed interface accordingly), or using a JSON source that actually contains a title field for plugins.
| plugin: "plugins.json", | |
| }; | |
| }; |
Summary
Adds Open Graph and Twitter Card meta tags to the website layout so pages render rich previews when shared on social media (Facebook, Twitter/X, LinkedIn, Discord, etc.).
Changes
website/src/layouts/BaseLayout.astroog:type,og:url,og:title,og:description,og:image,og:site_namemeta tagstwitter:card(summary_large_image),twitter:title,twitter:description,twitter:imagemeta tags<link>element-to|(e.g.Agents | Awesome GitHub Copilot)social-image.pngfrompublic/images/website/src/scripts/modal.tsdocument.titleupdates dynamically when a modal opens to reflect the resource being viewed (e.g.Accessibility Expert | Awesome GitHub Copilot)titleproperty rather than the raw filenamewebsite/public/images/social-image.pngTesting
npm run buildandnpx astro buildboth pass