Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukechilds/parcel-plugin-ogimage
Set absolute URL for og:image meta tags.
https://github.com/lukechilds/parcel-plugin-ogimage
parcel parcel-bundler parcel-plugin
Last synced: 41 minutes ago
JSON representation
Set absolute URL for og:image meta tags.
- Host: GitHub
- URL: https://github.com/lukechilds/parcel-plugin-ogimage
- Owner: lukechilds
- License: mit
- Created: 2019-04-28T08:08:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-20T00:31:57.000Z (over 4 years ago)
- Last Synced: 2024-11-01T23:50:24.290Z (7 days ago)
- Topics: parcel, parcel-bundler, parcel-plugin
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 22
- Watchers: 3
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-parcel - parcel-plugin-ogimage
README
# parcel-plugin-ogimage
> Set absolute URL for og:image meta tags.
[![Build Status](https://travis-ci.com/lukechilds/parcel-plugin-ogimage.svg?branch=master)](https://travis-ci.com/lukechilds/parcel-plugin-ogimage)
[![npm](https://img.shields.io/npm/v/parcel-plugin-ogimage.svg)](https://www.npmjs.com/package/parcel-plugin-ogimage)Sets absolute URLs for `og:image` meta tags. This is required by the spec and relative URLs will not work on some sites such as Twitter.
You can fix this directly in parcel by using `--public-url https://example.com`, however now all your URLs are hardcoded to absolute URLs which may be undesirable and can break things like prerendering.
This plugin uses the value of the `og:url` meta tag to convert `og:image` to an absolute URL.
## Install
```shell
npm install parcel-plugin-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:
```html
```
Parcel will generate that into something like this:
```html
```
`parcel-plugin-ogimage` will then update the `og:image` with an absolute URL:
```html
```
## License
MIT © Luke Childs