Require title not to have too long text

Rule ID:
long-title
Category:
SEO
Standards:
-
Fixable:
No

Search engines truncates titles with too long text, typically only displaying the first 60-70 characters. Possibly down-ranking the page in the process as it raises the suspicion of keyword stuffing.

See MDN recommendation and WCAG G88: Providing descriptive titles.

Rule details

Examples of incorrect code for this rule:

<head>
  <title>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
    labore et dolore magna aliqua.
  </title>
</head>
error: title text cannot be longer than 70 characters (long-title)
  3 |     Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
  4 |     labore et dolore magna aliqua.
> 5 |   </title>
    |          ^
  6 | </head>


1 error found.

Examples of correct code for this rule:

<head>
  <title>Lorem ipsum</title>
</head>

Options

This rule takes an optional object:

{
  "maxlength": 120
}

maxlength

Set a custom max length (inclusive).