linkie is a library that extracts meta information about a link.
url-> Full URL whose meta information is to be fetched
options-> Options for the fetching
verifyImage-> After successfully extracting image about the link,
linkiecan also validate if image really exists or not. By default this option is disabled and hence
linkiewill not verify the image. But if you want to verify the image just pass
linkiewill make another request and verufy if image is valid or not. If image does not exist then metadata will not contain field
Explain me the output
url-> The URL that was fetched.
status-> HTTP Response status code
host-> Hostname from which response was served
title-> Title of the page
description-> Meta description about the link
type-> type of the page that link points to
keywords-> Meta keywords about the link
image-> meta image about the link
If a youtube link is given then the metadata will contain field
will contain the video id in field
vid that you can directly use to embed
in Youtube Player.
Meta information and where it fetches from
The meta information about the link contains several fields. There is a
possibility that some information might not be present on the page, hence
linkie tries its best to get information. There is fallback on all important
fields. For each of the following fields the list represents the places it
tries to fetch information from.
- OG Title
- OG Description
<p>tags, combined to minimum length of 128 characters.
- OG Image
- First image tag
- OG Type
Setup a development environment
Make sure you have
Install all the required dependencies
Start local development server
This will start a local development server that listens on file change and rebuilds everytime that file is changed.
See if everythign is working
In the repository you will find a file named
basic.js, execute the file
and see the output.
You should now see the output that looks something like this