All rules

Sheath rule

seo-require-open-graph

Pages should have Open Graph meta tags for social sharing.
Package
Core
Category
SEO
Default severity
warning by default
Auto-fix
Manual fix

#Why

When a link is pasted into Slack, LinkedIn, Facebook or a messaging app, the preview card is built from Open Graph tags. Without them the platform falls back to guessing a title and picking an image off the page, or renders a bare URL.

The tags are read by a crawler at share time, so they have to be in the served HTML rather than added by client-side JavaScript.

#Examples

#Bad

<!-- Missing Open Graph tags -->
<head>
<meta charset="utf-8">
<title>My Article</title>
</head>
<!-- Incomplete OG tags -->
<head>
<meta property="og:title" content="My Article">
<!-- Missing og:type, og:image, og:url -->
</head>
<!-- Property names without usable values are still incomplete -->
<head>
<meta property="og:title" content="">
<meta property="og:type">
</head>

#Good

<!-- Complete Open Graph tags -->
<head>
<meta charset="utf-8">
<title>My Article - Site Name</title>
<!-- Required OG tags -->
<meta property="og:title" content="My Article">
<meta property="og:type" content="article">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:url" content="https://example.com/article">
<!-- Recommended OG tags -->
<meta property="og:description" content="A compelling description of the article.">
<meta property="og:site_name" content="My Site">
</head>

#Required Properties

Every checked page must provide these Open Graph properties.

Property Description Example
og:title Title of the content Introducing the Spring Collection
og:type Type of content article, website, product
og:image Image URL (absolute) https://example.com/img.jpg
og:url Canonical URL https://example.com/article

#Recommended Properties

Add these properties when the corresponding content is available.

Property Description
og:description Brief description (1-2 sentences)
og:site_name Name of the website

og:locale is also useful when a page needs an explicit language and territory (for example, en_US), but it is optional and not required.

#Image Properties (Optional)

Image dimensions help consumers reserve the correct preview space.

Property Description
og:image:width Image width in pixels
og:image:height Image height in pixels
og:image:alt Alt text for the image

#Options

Use these options to require recommended metadata or image dimensions.

Option Type Default Description
checkRecommended bool false Also require og:description and og:site_name
checkImageProperties bool false Check for image dimension tags
<?php
'seo-require-open-graph' => ['warning', [
'checkRecommended' => true,
'checkImageProperties' => true,
]],

#Image Recommendations

  • Minimum size: 200x200 pixels
  • Recommended size: 1200x630 pixels (for Facebook)
  • Aspect ratio: 1.91:1 is ideal
  • Format: JPG, PNG, GIF
  • File size: Under 8MB

#Common og:type Values

Choose the type that best describes the page's primary content.

Type Use Case
website Home page, general pages
article Blog posts, news articles
product E-commerce product pages
profile User profile pages
video.movie Video content

#Notes

  • A dynamic property value is left for runtime and suppresses completeness diagnostics.
  • Every required property must exist with usable content on every render path.
  • Only documents with a <head> element are checked
  • Missing Open Graph tags are not reported when <head> contains dynamic content such as <x-seo>, <s:se_meta>, @include, @stack, @yield, or {!! ... !!}
  • OG tags use property attribute, not name
  • A matching property needs a non-empty content value. Blade-generated or otherwise dynamic content is accepted when it cannot be evaluated statically.
  • Images should use absolute URLs, not relative

#Related Rules