Skip to content

Commit

Permalink
feat: added support for meta.name attribute twitter:image property (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-Bernardito authored Feb 8, 2021
1 parent eda85d9 commit 6fff934
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Supported tags and attributes:
- the `href` attribute of the `use` tag
- 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`
- 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`
- 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`
- 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`

#### `Boolean`

Expand Down
1 change: 1 addition & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ function metaContentFilter(tag, attribute, attributes) {
'msapplication-wide310x150logo',
'msapplication-square310x310logo',
'msapplication-config',
'twitter:image',
];

return allowedNames.includes(name);
Expand Down
9 changes: 6 additions & 3 deletions test/__snapshots__/esModule-option.test.js.snap

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion test/__snapshots__/loader.test.js.snap

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions test/__snapshots__/minimize-option.test.js.snap

Large diffs are not rendered by default.

36 changes: 24 additions & 12 deletions test/__snapshots__/sources-option.test.js.snap

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/fixtures/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ <h2>An Ordered HTML List</h2>
<link rel="manifest" href="./site.webmanifest">
<link rel="mask-icon" href="./webpack.svg" color="#5bbad5">
<link rel="preload" as="image" imagesrcset="image.png 400w, image.png 800w, image.png 1600w" imagesizes="100vw">
<meta name="twitter:image" content="./image.png">
<meta name="msapplication-square70x70logo" content="./image.png">
<meta NAME="msapplication-square70x70logo" content="./image.png">
<meta name="msapplication-square150x150logo" content="./image.png">
Expand Down

0 comments on commit 6fff934

Please sign in to comment.