Skip to content

takeokunn/parcel-transformer-ogimage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parcel-transformer-ogimage

npm version

Set absolute URL for og:image meta tags by parcel ver >= 2.0.0.

Inspired by lukechilds/parcel-plugin-ogimage

Install

$ npm install -D parcel-transformer-ogimage

Create .parcelrc file and paste:

{
  "extends": "@parcel/config-default",
  "transformers": {"*.html":["...","parcel-transformer-ogimage"]}
}

Usage

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

You must have both og:image and og:url meta tags:

<meta property="og:image" content="card.png">
<meta property="og:url" content="https://example.com">

Parcel will generate that into something like this:

<meta property="og:image" content="/card.9190ce93.png">
<meta property="og:url" content="https://example.com">

Works also for twitter:image.

<meta name="twitter:image" content="/card.9190ce93.png">

parcel-plugin-ogimage will then update the og:image with an absolute URL:

<meta property="og:image" content="https://example.com/card.9190ce93.png">
<meta property="og:url" content="https://example.com">
<meta name="twitter:image" content="https://example.com/card.9190ce93.png">

LICENSE

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •