Update Open Graph metadata and improve document readability#48
Update Open Graph metadata and improve document readability#48olamide226 merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves SEO/social sharing previews by refactoring Open Graph/Twitter metadata generation in the Astro docs site config and removes author attribution lines from two spec documents for consistency/privacy.
Changes:
- Centralized site + OG image URL/alt text as constants and expanded Open Graph image metadata.
- Improved Twitter card metadata with image alt text and an additional
image_srclink. - Removed
Authorsfields fromspec/INTEGRATION-GUIDE.mdandspec/SECURITY-MODEL.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/astro.config.mjs | Refactors and expands OG/Twitter meta tags with shared constants for consistent previews. |
| spec/SECURITY-MODEL.md | Removes Authors line from the document header block. |
| spec/INTEGRATION-GUIDE.md | Removes Authors line from the document header block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| const siteUrl = 'https://rep-protocol.dev'; | ||
| const ogImagePath = '/og-image.png'; | ||
| const ogImageUrl = `${siteUrl}${ogImagePath}`; |
There was a problem hiding this comment.
Constructing URLs via string concatenation is brittle if siteUrl ever gains a trailing slash or ogImagePath changes (can lead to double slashes or missing slashes). Prefer constructing the URL via the URL constructor (e.g., new URL(ogImagePath, siteUrl).toString()) to make this resilient to future edits.
| const ogImageUrl = `${siteUrl}${ogImagePath}`; | |
| const ogImageUrl = new URL(ogImagePath, siteUrl).toString(); |
| tag: 'link', | ||
| attrs: { | ||
| rel: 'image_src', | ||
| href: ogImageUrl, | ||
| }, | ||
| }, | ||
| { |
There was a problem hiding this comment.
The link[rel=\"image_src\"] hint is non-standard/deprecated and is ignored by most modern crawlers in favor of Open Graph/Twitter tags. Consider removing it (or documenting why it’s needed) to avoid validator/linter warnings and reduce head noise.
| tag: 'link', | |
| attrs: { | |
| rel: 'image_src', | |
| href: ogImageUrl, | |
| }, | |
| }, | |
| { |
This pull request enhances the site's SEO and social sharing capabilities by improving how Open Graph and Twitter meta tags are generated in the
astro.config.mjsfile. It also makes minor documentation updates by removing theAuthorsfield from two spec markdown files.Improvements to meta tags and SEO:
docs/astro.config.mjsto definesiteUrl,ogImagePath,ogImageUrl, andogImageAltas constants for reuse and consistency.og:image:secure_url,og:image:type,og:image:width,og:image:height, andog:image:altto improve link previews on social platforms.twitter:image:alt, as well as including alinktag forimage_srcto further improve social sharing.Documentation updates:
Authorsfield fromspec/INTEGRATION-GUIDE.mdfor consistency and privacy.Authorsfield fromspec/SECURITY-MODEL.mdfor consistency and privacy.