yoda-seo-tips
Version:
SEO tips from Yoda
26 lines • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const rules_1 = require("./rules");
// Yoda talks in Object-Subject-Verb grammar, trying to immitate it in the messages here
// https://en.wikipedia.org/wiki/Object%E2%80%93subject%E2%80%93verb
exports.imgMustHaveAlt = rules_1.mustHaveAttribute('img', 'alt', n => `alt attribute in <img> tag there should be`);
exports.aMustHaveRel = rules_1.mustHaveAttribute('a', 'rel', n => `rel attribute in <a> tag there should be`);
exports.mustHaveTitle = rules_1.mustHaveElement('head > title', () => `<title> tag this document should have`);
exports.mustHaveDescription = rules_1.mustHaveElement('head > meta[name=description]', () => `<meta name="descriptions"> tag this document should have`);
exports.mustHaveKeywords = rules_1.mustHaveElement('head > meta[name=keywords]', () => `<meta name="keywords"> tag this document should have`);
exports.notTooManyStrongs = (howMany) => rules_1.mustHaveNoMoreThan('strong', howMany, (n) => `${n} <strong> tags I count. More than ${howMany} should be not.`);
exports.onlyOneH1 = rules_1.mustHaveNoMoreThan('h1', 1, (n) => `${n} <h1> tags I count. One only chosen there should be.`);
function yodaWisdom(config = {}) {
return [
exports.imgMustHaveAlt,
exports.aMustHaveRel,
exports.mustHaveTitle,
exports.mustHaveDescription,
exports.mustHaveKeywords,
exports.notTooManyStrongs(config.maxStrongTags || 15),
exports.onlyOneH1,
...(config.extraRules || [])
];
}
exports.yodaWisdom = yodaWisdom;
//# sourceMappingURL=yodaWisdom.js.map