🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

article-title

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

article-title

Extract the article title of a HTML document

4.1.0
latest
Source
npm
Version published
Weekly downloads
222
6.22%
Maintainers
1
Weekly downloads
 
Created
Source

article-title

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

import articleTitle from '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'
  • article-title-cli - CLI for this module

Keywords

article

FAQs

Package last updated on 02 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts