import {Meta} from '@storybook/addon-docs/blocks'

<Meta title='@dxtmisha/en/functional-basic/Classes/MetaTwitter - Twitter Card Meta Tags'/>

# MetaTwitter Class

Extends `MetaManager`. Manages [Twitter Card](https://developer.twitter.com/en/docs/twitter-for-websites/cards) meta tags — used by Twitter/X to generate cards when sharing links.

## Initialization

To manage Twitter Card data, call the `new MetaTwitter()` constructor.

**Features:**
- **Inheritance** — extends `MetaManager`, using the standard `name` attribute to manage tags.
- **Standard** — comes with a predefined list of all primary [Twitter Card](https://developer.twitter.com/en/docs/twitter-for-websites/cards) protocol tags.

```javascript
import { MetaTwitter } from '@dxtmisha/functional-basic'

const twitter = new MetaTwitter()
```

## Supported Tags

Manages the following `twitter:*` tags: `twitter:card`, `twitter:site`, `twitter:creator`, `twitter:url`, `twitter:title`, `twitter:description`, `twitter:image`.

## Getters

- `getCard(): MetaTwitterCard` — card type (`'summary'`, `'summary_large_image'`, `'app'`, `'player'`).
- `getSite(): string` — @username of the website or brand account.
- `getCreator(): string` — @username of the content creator.
- `getUrl(): string` — page URL.
- `getTitle(): string` — card title.
- `getDescription(): string` — card description.
- `getImage(): string` — image URL.

## Setters

All setters update the tag in the DOM and return `this` for chaining.

- `setCard(card: MetaTwitterCard): this` — card type.
- `setSite(site: string): this` — site @username.
- `setCreator(creator: string): this` — creator @username.
- `setUrl(url: string): this`
- `setTitle(title: string): this`
- `setDescription(description: string): this`
- `setImage(image: string): this`

## Example

```javascript
import { MetaTwitter } from '@dxtmisha/functional-basic'

const twitter = new MetaTwitter()

twitter
  .setCard('summary_large_image')
  .setSite('@mycompany')
  .setCreator('@author')
  .setTitle('Post Title')
  .setDescription('Brief description')
  .setUrl('https://example.com/post/1')
  .setImage('https://example.com/images/preview.jpg')

// For SSR
const html = twitter.html()
// '<meta name="twitter:card" content="summary_large_image">...'
```
