website-auditfy
Version:
> Tool for validate your project on SEO, HTML, CSS, JS, TS, Performance, Security and A11Y
25 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CanonicalNotLocalhostRule = void 0;
const message_model_1 = require("../../../models/message.model");
const message_enum_1 = require("../../../enum/message.enum");
class CanonicalNotLocalhostRule {
constructor(dom, lightHouse) {
this.id = 'canonical-not-localhost';
this.tags = ['html', 'seo'];
this.description = 'Canonical must be not localhost';
this.ruleUrl = 'https://developer.chrome.com/docs/lighthouse/seo/canonical';
this.dom = dom;
this.lightHouse = lightHouse;
}
check() {
const canonical = this.dom('link[rel="canonical"]').attr('href');
const present = !!canonical;
const notLocalhost = present && !(canonical === null || canonical === void 0 ? void 0 : canonical.includes('localhost'));
return [
message_model_1.Message.create(`${this.description} is not localhost`, notLocalhost ? message_enum_1.MessageType.passed : this.ruleFlow),
];
}
}
exports.CanonicalNotLocalhostRule = CanonicalNotLocalhostRule;
//# sourceMappingURL=canonical-not-localhost.rule.js.map