Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: seo audits; add it in Polish #7125

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lighthouse-core/audits/seo/canonical.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ const LinkHeader = require('http-link-header');
const URL = require('../../lib/url-shim');
const MainResource = require('../../computed/main-resource.js');
const LINK_HEADER = 'link';
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Document has a valid `rel=canonical`',
failureTitle: 'Document does not have a valid `rel=canonical`',
description: 'Canonical links suggest which URL to show in search results. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/canonical).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

/**
* @param {string} headerValue
Expand Down Expand Up @@ -62,10 +72,9 @@ class Canonical extends Audit {
static get meta() {
return {
id: 'canonical',
title: 'Document has a valid `rel=canonical`',
failureTitle: 'Document does not have a valid `rel=canonical`',
description: 'Canonical links suggest which URL to show in search results. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/canonical).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Canonical', 'Hreflang', 'URL'],
};
}
Expand Down Expand Up @@ -175,3 +184,4 @@ class Canonical extends Audit {
}

module.exports = Canonical;
module.exports.UIStrings = UIStrings;
20 changes: 15 additions & 5 deletions lighthouse-core/audits/seo/hreflang.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ const MainResource = require('../../computed/main-resource.js');
const VALID_LANGS = importValidLangs();
const LINK_HEADER = 'link';
const NO_LANGUAGE = 'x-default';
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Document has a valid `hreflang`',
failureTitle: 'Document doesn\'t have a valid `hreflang`',
description: 'hreflang links tell search engines what version of a page they should ' +
'list in search results for a given language or region. [Learn more]' +
'(https://developers.google.com/web/tools/lighthouse/audits/hreflang).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

/**
* Import list of valid languages from axe core without including whole axe-core package
Expand Down Expand Up @@ -65,11 +76,9 @@ class Hreflang extends Audit {
static get meta() {
return {
id: 'hreflang',
title: 'Document has a valid `hreflang`',
failureTitle: 'Document doesn\'t have a valid `hreflang`',
description: 'hreflang links tell search engines what version of a page they should ' +
'list in search results for a given language or region. [Learn more]' +
'(https://developers.google.com/web/tools/lighthouse/audits/hreflang).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['Hreflang', 'URL'],
};
}
Expand Down Expand Up @@ -119,3 +128,4 @@ class Hreflang extends Audit {
}

module.exports = Hreflang;
module.exports.UIStrings = UIStrings;
20 changes: 15 additions & 5 deletions lighthouse-core/audits/seo/http-status-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ const Audit = require('../audit');
const MainResource = require('../../computed/main-resource.js');
const HTTP_UNSUCCESSFUL_CODE_LOW = 400;
const HTTP_UNSUCCESSFUL_CODE_HIGH = 599;
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Page has successful HTTP status code',
failureTitle: 'Page has unsuccessful HTTP status code',
description: 'Pages with unsuccessful HTTP status codes may not be indexed properly. ' +
'[Learn more]' +
'(https://developers.google.com/web/tools/lighthouse/audits/successful-http-code).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class HTTPStatusCode extends Audit {
/**
Expand All @@ -17,11 +28,9 @@ class HTTPStatusCode extends Audit {
static get meta() {
return {
id: 'http-status-code',
title: 'Page has successful HTTP status code',
failureTitle: 'Page has unsuccessful HTTP status code',
description: 'Pages with unsuccessful HTTP status codes may not be indexed properly. ' +
'[Learn more]' +
'(https://developers.google.com/web/tools/lighthouse/audits/successful-http-code).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['devtoolsLogs', 'URL'],
};
}
Expand Down Expand Up @@ -55,3 +64,4 @@ class HTTPStatusCode extends Audit {
}

module.exports = HTTPStatusCode;
module.exports.UIStrings = UIStrings;
20 changes: 15 additions & 5 deletions lighthouse-core/audits/seo/is-crawlable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ const BLOCKLIST = new Set([
]);
const ROBOTS_HEADER = 'x-robots-tag';
const UNAVAILABLE_AFTER = 'unavailable_after';
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Page isn’t blocked from indexing',
failureTitle: 'Page is blocked from indexing',
description: 'Search engines are unable to include your pages in search results ' +
'if they don\'t have permission to crawl them. [Learn ' +
'more](https://developers.google.com/web/tools/lighthouse/audits/indexing).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

/**
* Checks if given directive is a valid unavailable_after directive with a date in the past
Expand Down Expand Up @@ -64,11 +75,9 @@ class IsCrawlable extends Audit {
static get meta() {
return {
id: 'is-crawlable',
title: 'Page isn’t blocked from indexing',
failureTitle: 'Page is blocked from indexing',
description: 'Search engines are unable to include your pages in search results ' +
'if they don\'t have permission to crawl them. [Learn ' +
'more](https://developers.google.com/web/tools/lighthouse/audits/indexing).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['MetaElements', 'RobotsTxt', 'URL'],
};
}
Expand Down Expand Up @@ -134,3 +143,4 @@ class IsCrawlable extends Audit {
}

module.exports = IsCrawlable;
module.exports.UIStrings = UIStrings;
18 changes: 14 additions & 4 deletions lighthouse-core/audits/seo/link-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ const BLOCKLIST = new Set([
'more',
'learn more',
]);
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Links have descriptive text',
failureTitle: 'Links do not have descriptive text',
description: 'Descriptive link text helps search engines understand your content. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class LinkText extends Audit {
/**
Expand All @@ -26,10 +36,9 @@ class LinkText extends Audit {
static get meta() {
return {
id: 'link-text',
title: 'Links have descriptive text',
failureTitle: 'Links do not have descriptive text',
description: 'Descriptive link text helps search engines understand your content. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['URL', 'CrawlableLinks'],
};
}
Expand Down Expand Up @@ -81,3 +90,4 @@ class LinkText extends Audit {
}

module.exports = LinkText;
module.exports.UIStrings = UIStrings;
20 changes: 15 additions & 5 deletions lighthouse-core/audits/seo/meta-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
'use strict';

const Audit = require('../audit');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Document has a meta description',
failureTitle: 'Document does not have a meta description',
description: 'Meta descriptions may be included in search results to concisely summarize ' +
'page content. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/description).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class Description extends Audit {
/**
Expand All @@ -14,11 +25,9 @@ class Description extends Audit {
static get meta() {
return {
id: 'meta-description',
title: 'Document has a meta description',
failureTitle: 'Document does not have a meta description',
description: 'Meta descriptions may be included in search results to concisely summarize ' +
'page content. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/description).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['MetaElements'],
};
}
Expand Down Expand Up @@ -50,3 +59,4 @@ class Description extends Audit {
}

module.exports = Description;
module.exports.UIStrings = UIStrings;
20 changes: 15 additions & 5 deletions lighthouse-core/audits/seo/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ const SOURCE_PARAMS = new Set([
'source',
'src',
]);
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Document avoids plugins',
failureTitle: 'Document uses plugins',
description: 'Search engines can\'t index plugin content, and ' +
'many devices restrict plugins or don\'t support them. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/plugins).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

/**
* Verifies if given MIME type matches any known plugin MIME type
Expand Down Expand Up @@ -73,11 +84,9 @@ class Plugins extends Audit {
static get meta() {
return {
id: 'plugins',
title: 'Document avoids plugins',
failureTitle: 'Document uses plugins',
description: 'Search engines can\'t index plugin content, and ' +
'many devices restrict plugins or don\'t support them. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/plugins).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['EmbeddedContent'],
};
}
Expand Down Expand Up @@ -154,3 +163,4 @@ class Plugins extends Audit {
}

module.exports = Plugins;
module.exports.UIStrings = UIStrings;
18 changes: 14 additions & 4 deletions lighthouse-core/audits/seo/robots-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ const DIRECTIVE_SAFELIST = new Set([
'request-rate', 'visit-time', 'noindex', // not officially supported, but used in the wild
]);
const SITEMAP_VALID_PROTOCOLS = new Set(['https:', 'http:', 'ftp:']);
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'robots.txt is valid',
failureTitle: 'robots.txt is not valid',
description: 'If your robots.txt file is malformed, crawlers may not be able to understand ' +
'how you want your website to be crawled or indexed.',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

/**
* @param {string} directiveName
Expand Down Expand Up @@ -161,10 +171,9 @@ class RobotsTxt extends Audit {
static get meta() {
return {
id: 'robots-txt',
title: 'robots.txt is valid',
failureTitle: 'robots.txt is not valid',
description: 'If your robots.txt file is malformed, crawlers may not be able to understand ' +
'how you want your website to be crawled or indexed.',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['RobotsTxt'],
};
}
Expand Down Expand Up @@ -228,3 +237,4 @@ class RobotsTxt extends Audit {
}

module.exports = RobotsTxt;
module.exports.UIStrings = UIStrings;
19 changes: 14 additions & 5 deletions lighthouse-core/audits/seo/tap-targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ const FINGER_SIZE_PX = 48;
// to the finger area tapping on the intended element
const MAX_ACCEPTABLE_OVERLAP_SCORE_RATIO = 0.25;

const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
title: 'Tap targets are sized appropriately',
failureTitle: 'Tap targets are not sized appropriately',
description:'Interactive elements like buttons and links should be large enough (48x48px), and have enough space around them,' +
'to be easy enough to tap without overlapping onto other elements. ' +
'[Learn more](https://developers.google.com/web/fundamentals/accessibility/accessible-styles#multi-device_responsive_design).',
}

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
/**
* @param {LH.Artifacts.Rect} cr
*/
Expand Down Expand Up @@ -244,10 +254,9 @@ class TapTargets extends Audit {
static get meta() {
return {
id: 'tap-targets',
title: 'Tap targets are sized appropriately',
failureTitle: 'Tap targets are not sized appropriately',
description:
'Interactive elements like buttons and links should be large enough (48x48px), and have enough space around them, to be easy enough to tap without overlapping onto other elements. [Learn more](https://developers.google.com/web/fundamentals/accessibility/accessible-styles#multi-device_responsive_design).',
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['MetaElements', 'TapTargets'],
};
}
Expand Down Expand Up @@ -298,7 +307,7 @@ class TapTargets extends Audit {
TapTargets.FINGER_SIZE_PX = FINGER_SIZE_PX;

module.exports = TapTargets;

module.exports.UIStrings = UIStrings;

/** @typedef {{
overlapScoreRatio: number;
Expand Down
Loading