Generates Twitter Card 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.
name
property
import { twitter } from '@raven-js/beak/seo';const tags = twitter({ title: 'My Page', description: 'This is my page description', imageUrl: '/my-image.jpg', cardType: 'summary_large_image'});// Output:// <meta name="twitter:card" property="twitter:card" content="summary_large_image" />// <meta name="twitter:title" property="twitter:title" content="My Page" />// <meta name="twitter:description" property="twitter:description" content="This is my page description" />// <meta name="twitter:image" property="twitter:image" content="https://example.com/my-image.jpg" />// <meta name="twitter:image:src" property="twitter:image:src" content="https://example.com/my-image.jpg">// <meta name="twitter:image:alt" property="twitter:image:alt" content="Illustration of My Page"> Copy
import { twitter } from '@raven-js/beak/seo';const tags = twitter({ title: 'My Page', description: 'This is my page description', imageUrl: '/my-image.jpg', cardType: 'summary_large_image'});// Output:// <meta name="twitter:card" property="twitter:card" content="summary_large_image" />// <meta name="twitter:title" property="twitter:title" content="My Page" />// <meta name="twitter:description" property="twitter:description" content="This is my page description" />// <meta name="twitter:image" property="twitter:image" content="https://example.com/my-image.jpg" />// <meta name="twitter:image:src" property="twitter:image:src" content="https://example.com/my-image.jpg">// <meta name="twitter:image:alt" property="twitter:image:alt" content="Illustration of My Page">
Configuration object for Twitter Card tags
The generated Twitter Card meta tags as an HTML string
Generates Twitter Card meta tags for the HTML head section.
Since various social media platforms parse these tags differently, every tag uses both
name
andproperty
attributes for maximum compatibility.Example