Skip to content

plumdumpling/parcel-plugin-meta-images

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parcel-plugin-meta-images

Sets absolute URLs for og:image and twitter:image meta tags. This is required by the spec and relative URLs will not work on some sites such as Facebook and Twitter.

This plugin uses the value of the og:url meta tag to convert the image paths to an absolute URL.

Install

npm install --save-dev git+https://github.com/plumdumpling/parcel-plugin-meta-images.git

Usage

Just install this package as a development dependency. Parcel will automatically call it when building your application.

Make sure you have og:url, og:image and twitter:image meta tags in your html files:

<meta property="og:url" content="https://example.com">
<meta property="og:image" content="../assets/preview-image.png">
<meta name="twitter:image" content="../assets/twitter-preview-image.png">

Parcel will generate that into something like this:

<meta property="og:url" content="https://example.com">
<meta property="og:image" content="/preview-image.1a2b3c4d.png">
<meta name="twitter:image" content="/twitter-preview-image.1a2b3c4d.png">

parcel-plugin-meta-image will then update the image paths to an absolute URL:

<meta property="og:url" content="https://example.com">
<meta property="og:image" content="https://example.com/preview-image.1a2b3c4d.png">
<meta name="twitter:image" content="https://example.com/twitter-preview-image.1a2b3c4d.png">

License

MIT

About

Set absolute URL for og:image meta tags.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%