parcel-transformer-ogimage

1.0.3 • Public • Published

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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i parcel-transformer-ogimage

    Weekly Downloads

    6

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    2.17 MB

    Total Files

    7

    Last publish

    Collaborators

    • takeokunn