Function openGraph

Generates Open Graph meta tags for the HTML head section.

Since various social media platforms parse these tags differently, every tag uses both name and property attributes for maximum compatibility.

import { openGraph } from '@raven-js/beak/seo';

const tags = openGraph({
title: 'My Page',
description: 'This is my page description',
domain: 'example.com',
path: '/my-page',
imageUrl: '/my-image.jpg',
type: 'article'
});
// Output:
// <meta name="og:type" property="og:type" content="article">
// <meta name="og:title" property="og:title" content="My Page" />
// <meta name="og:description" property="og:description" content="This is my page description" />
// <meta name="og:url" property="og:url" content="https://example.com/my-page" />
// <meta name="og:image" property="og:image" content="https://example.com/my-image.jpg" />
  • Parameters

    • config: OpenGraphConfig

      Configuration object for Open Graph tags

    Returns string

    The generated Open Graph meta tags as an HTML string