article-title
Extract the article title of a HTML document
Last updated 6 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install article-title 
SYNC missed versions from official npm registry.

article-title Build Status

Extract the article title of a HTML document

It's often quite hard to get the actual title of an article from a page as authors either add a bunch of trash to <title> or don't use it at all. There's also no standardized way to indicate the title of an article in the markup. This module uses some heuristics to extract it cleanly.

Install

$ npm install article-title

Usage

const articleTitle = require('article-title');

const html = `
<!doctype html>
	<html>
		<head>
			<title>My awesome unicorn website</title>
		</head>
	<body>
		<article>
			<h1>How unicorns sleep</h1>
			<p>...</p>
		</article>
	</body>
</html>
`;

articleTitle(html);
//=> 'How unicorns sleep'

Related

Current Tags

  • 3.1.0                                ...           latest (6 months ago)

9 Versions

  • 3.1.0                                ...           6 months ago
  • 3.0.0                                ...           6 months ago
  • 2.0.0                                ...           3 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |