Skip to content

Commit 6fff934

Browse files
feat: added support for meta.name attribute twitter:image property (#348)
1 parent eda85d9 commit 6fff934

File tree

7 files changed

+47
-26
lines changed

7 files changed

+47
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Supported tags and attributes:
8787
- the `href` attribute of the `use` tag
8888
- the `href` attribute of the `link` tag when the `rel` attribute contains `stylesheet`, `icon`, `shortcut icon`, `mask-icon`, `apple-touch-icon`, `apple-touch-icon-precomposed`, `apple-touch-startup-image`, `manifest`, `prefetch`, `preload`
8989
- the `imagesrcset` attribute of the `link` tag when the `rel` attribute contains `stylesheet`, `icon`, `shortcut icon`, `mask-icon`, `apple-touch-icon`, `apple-touch-icon-precomposed`, `apple-touch-startup-image`, `manifest`, `prefetch`, `preload`
90-
- the `content` attribute of the `meta` tag when the `name` attribute is `msapplication-tileimage`, `msapplication-square70x70logo`, `msapplication-square150x150logo`, `msapplication-wide310x150logo`, `msapplication-square310x310logo`, `msapplication-config` or when the `property` attribute is `og:image`, `og:image:url`, `og:image:secure_url`, `og:audio`, `og:audio:secure_url`, `og:video`, `og:video:secure_url`, `vk:image`
90+
- the `content` attribute of the `meta` tag when the `name` attribute is `msapplication-tileimage`, `msapplication-square70x70logo`, `msapplication-square150x150logo`, `msapplication-wide310x150logo`, `msapplication-square310x310logo`, `msapplication-config`, `twitter:image` or when the `property` attribute is `og:image`, `og:image:url`, `og:image:secure_url`, `og:audio`, `og:audio:secure_url`, `og:video`, `og:video:secure_url`, `vk:image`
9191

9292
#### `Boolean`
9393

src/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ function metaContentFilter(tag, attribute, attributes) {
587587
'msapplication-wide310x150logo',
588588
'msapplication-square310x310logo',
589589
'msapplication-config',
590+
'twitter:image',
590591
];
591592

592593
return allowedNames.includes(name);

test/__snapshots__/esModule-option.test.js.snap

Lines changed: 6 additions & 3 deletions
Large diffs are not rendered by default.

test/__snapshots__/loader.test.js.snap

Lines changed: 2 additions & 1 deletion
Large diffs are not rendered by default.

test/__snapshots__/minimize-option.test.js.snap

Lines changed: 12 additions & 9 deletions
Large diffs are not rendered by default.

test/__snapshots__/sources-option.test.js.snap

Lines changed: 24 additions & 12 deletions
Large diffs are not rendered by default.

test/fixtures/simple.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ <h2>An Ordered HTML List</h2>
382382
<link rel="manifest" href="./site.webmanifest">
383383
<link rel="mask-icon" href="./webpack.svg" color="#5bbad5">
384384
<link rel="preload" as="image" imagesrcset="image.png 400w, image.png 800w, image.png 1600w" imagesizes="100vw">
385+
<meta name="twitter:image" content="./image.png">
385386
<meta name="msapplication-square70x70logo" content="./image.png">
386387
<meta NAME="msapplication-square70x70logo" content="./image.png">
387388
<meta name="msapplication-square150x150logo" content="./image.png">

0 commit comments

Comments
 (0)