MCPcopy Create free account
hub / github.com/apache/camel-website / HtmlTitle

Class HtmlTitle

rules.js:3–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1const Rule = require("html-validate").Rule;
2
3class HtmlTitle extends Rule {
4 documentation(context) {
5 return {
6 description: "Title of the page must be defined"
7 };
8 }
9
10 setup() {
11 this.on("dom:ready", event => {
12 const title = event.document.querySelector('html head title');
13 if (title === null) {
14 this.report(event.document.querySelector('html'), "Missing <title> tag in the <head>");
15 }
16 else if (!title.textContent || title.textContent.trim().length === 0) {
17 this.report(title, "No title specified");
18 }
19 else if (title.textContent[0] === '-') {
20 this.report(title, "Title starts with the dash `-`, add the `title` front matter to the Hugo content");
21 }
22 else if (title.textContent.startsWith('Untitled')) {
23 this.report(title, "Title starts with the `Untitled` make sure that the Asciidoc file starts with level 1 heading");
24 }
25 });
26 }
27}
28
29class RelativeLinks extends Rule {
30 documentation(context) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected