Coder Social home page Coder Social logo

page-ogtags's Introduction

page-ogtags

Get OG tags with ease

Usage

import getMeta from 'page-ogtags';

const {title, description, url, locale, image} = await getMeta('https://www.atlassian.com/');

console.log(
  title,
  description,
  url,
  locale.alternate,
  image.url,
  image.type,
  image.width,
);

Features

  • Meta property serialization
<meta property="og:url" content="https://www.atlassian.com" />
<meta property="og:site_name" content="Atlassian" />
<meta property="og:full_site_name" content="Atlassian | 2017" />
{
  "url": "https://www.atlassian.com",
  "siteName": "Atlassian",
  "fullSiteName": "Atlassian | 2017"
}
  • Recursive mapping of tags into nested objects:
<meta property="og:image" content="https://wac-cdn.atlassian.com/dam/jcr:c20cf6d1-9568-4aba-9a16-dba24e1495de/[email protected]" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630">
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="400" />
<meta property="og:video:height" content="300" />
{
  "image": {
    "value": "https://wac-cdn.atlassian.com/dam/jcr:c20cf6d1-9568-4aba-9a16-dba24e1495de/[email protected]",
    "width": "1200",
    "height": "630"
  },
  "video": {
    "type": "application/x-shockwave-flash",
    "width": "400",
    "height": "300"
  }
}
  • Array support
<meta property="og:image" content="http://example.com/rock.jpg" />
<meta property="og:image" content="http://example.com/rock2.jpg" />
{
  "image": [
    "http://example.com/rock.jpg",
    "http://example.com/rock2.jpg"
  ]
}
  • Retrieve all og: tags from the page, officials or not.

TODO

  • babel-plugin-transform-flow-strip-types

page-ogtags's People

Contributors

zzarcon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

page-ogtags's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.