astrolib icon indicating copy to clipboard operation
astrolib copied to clipboard

Fixed og prefix: "og:" shouldn't be a prefix to open graph article, book, or profile tags

Open surya-ven opened this issue 10 months ago • 0 comments

I've made the following changes:

in packages/seo/src/utils/buildTags.ts:

  1. Added an optional ogPrefix flag parameter for the createOpenGraphTag function, which is by default true (i.e., includes the "og:" prefix by default)
  2. For Article, Profile, and Book Opengraph types, the use of the "og:" prefix is incorrect. For these, I passed in false for the ogPrefix flag. For example:
createOpenGraphTag("profile:first_name", config.openGraph.profile.firstName, false)

I've also added tests to validate all of the above changes.

Sources to validate this format:

  1. https://stackoverflow.com/questions/29748013/what-is-the-correct-implementation-of-the-open-graph-article-type
  2. https://ogp.me/ (it's more subtle, but it does state that article, book, and profile don't have "verticals", i.e., the official "og" namespace).

Additionally, I've also updated the package.json files for both the seo and analytics packages to accept Astro v5 as dependencies (including dev): "astro": "^1.2.1 || ^2.0.0 || ^3.0.0-beta.0 || ^3.0.0 || ^4.0.0 || ^5.0.0",

surya-ven avatar Dec 18 '24 18:12 surya-ven