Skip to content

Commit

Permalink
feat: canonical_count
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed May 6, 2020
1 parent 786ad89 commit b986eec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/scrap-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const fields_presets = {
'result.h2_count',
'result.h3_count',
'result.h4_count',
'result.canonical_count',
'result.images',
'result.images_without_alt',
'result.images_alt_empty',
Expand Down Expand Up @@ -149,6 +150,7 @@ module.exports = async (baseUrl, options = {}) => {
h2_count: $('h2').length,
h3_count: $('h3').length,
h4_count: $('h4').length,
canonical_count: $('link[rel="canonical"]').length,
dom_size: document.getElementsByTagName('*').length,
head_size: document.head.innerHTML.length,
body_size: document.body.innerHTML.length,
Expand Down
3 changes: 3 additions & 0 deletions src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const colsValidate = {
warning: (v) => v == 0,
error: (v) => v > 1,
},
canonical_count: {
warning: (v) => v > 1,
},
dom_size: {
warning: (v) => v > 1500,
error: (v) => v > 3000,
Expand Down

0 comments on commit b986eec

Please sign in to comment.