Package Exports
- head-meta
- head-meta/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (head-meta) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Head Meta (fetchHeadTags)
This is a Node.js package that extracts meta tags and link tags from a given URL. It can be used in both CommonJS and ES6 module environments.
Installation
You can install head-meta via npm:
npm install head-metaUsage
CommonJS Environment
const fetchHeadTags = require('head-meta');
fetchHeadTags('https://pratikchakraborty.in')
.then(tags => console.log(tags))
.catch(error => console.error(error));ES6 Modules
import fetchHeadTags from 'head-meta';
fetchHeadTags('https://pratikchakraborty.in')
.then(tags => console.log(tags))
.catch(error => console.error(error));API
fetchHeadTags(url: string): Promise<object>
This function fetches meta tags and link tags from the specified URL. Returns a Promise that resolves to an object containing the extracted meta tags and link tags.
Example output:
{
"metaTags": {
"viewport": "width=device-width, initial-scale=1",
"description": "Hi, I am Pratik Chakraborty and you are currently viewing my portfolio website. Check now!",
"og:title": "Pratik Chakraborty | portfolio",
"og:description": "Hi, I am Pratik Chakraborty and you are currently viewing my portfolio website. Check now!",
"og:type": "website",
"og:url": "https://www.pratikchakraborty.in",
"og:image": "https://nuxt-portfolio.s3.ap-south-1.amazonaws.com/static-assets/Screenshot+2024-01-07+041541.png",
"twitter:title": "Pratik Chakraborty | portfolio",
"twitter:description": "Hi, I am Pratik Chakraborty and you are currently viewing my portfolio website. Check now!",
"twitter:site": "https://www.pratikchakraborty.in",
"twitter:image": "https://nuxt-portfolio.s3.ap-south-1.amazonaws.com/static-assets/Screenshot+2024-01-07+041541.png",
"twitter:card": "summary_large_image"
},
"linkTags": {
"stylesheet": "/_nuxt/MainBar.CI57Swy6.css",
"modulepreload": "/_nuxt/MainBar.J0Q7xQTv.js",
"prefetch": "/_nuxt/error-500.rmXc9Dcc.js"
}
}Dependencies
- axios
- cheerio
License
MIT