Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Extract the article title of a HTML document
branch: master
Failed to load latest commit information.
fixture improve detection - fixes sindresorhus/urls-md#6
.editorconfig tweaks
.gitattributes init
.gitignore init
.jshintrc tweaks
.travis.yml Update .travis.yml
cli.js tweaks
index.js make sure there's actually a heading match before checking its length
license tweaks
package.json 1.0.1
readme.md Update readme.md
test.js tweaks

readme.md

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 various ways for extracting it cleanly.

Install

$ npm install --save article-title

Usage

var articleTitle = require('article-title');
var htmlDocument = '<!doctype html><html><head><title>My awesome unicorn website</title></head><body><article><h1>How unicorns sleep</h1><p>...</p></body></html>';

articleTitle(htmlDocument);
//=> How unicorns sleep

CLI

$ npm install --global article-title
$ article-title --help

  Usage
    article-title <file>
    curl <url> | article-title

  Example
    curl http://updates.html5rocks.com/2014/06/Automating-Web-Performance-Measurement | article-title
    Automating Web Performance Measurement

License

MIT © Sindre Sorhus

Something went wrong with that request. Please try again.