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 #6860

Merged
merged 32 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
31d658b
i18n v1 for SEO category.
exterkamp Dec 21, 2018
8c79982
Add link text test for multiple. Added link text displayValue label.
exterkamp Dec 21, 2018
c8b9f58
Removed imperative and reworded some description texts.
exterkamp Jan 2, 2019
42d8dda
Added multi-messages for font-size.
exterkamp Jan 2, 2019
60fc6b9
Reworded title descriptions based on feedback.
exterkamp Jan 3, 2019
b06fd1f
merge master
exterkamp Jan 29, 2019
8306ee7
Add SEO title i18n, fix tests.
exterkamp Jan 29, 2019
2c8eea0
Category description i18n.
exterkamp Jan 29, 2019
ffa4e7c
Add manual audit category desc.
exterkamp Jan 29, 2019
0570900
updated descriptions.
exterkamp Jan 31, 2019
f5b7751
merge in master
exterkamp Jan 31, 2019
7f47810
Adjusted text based on feedback.
exterkamp Feb 5, 2019
5b77efe
updated translations.
exterkamp Feb 5, 2019
3292058
Merge branch 'master' into i18n-seo
exterkamp Feb 5, 2019
b839a63
change for consistency to failureTitle.
exterkamp Feb 5, 2019
0f23dee
Forgot to update that last description in en-US.
exterkamp Feb 5, 2019
cf3ed80
merged in master...again
exterkamp Feb 11, 2019
feea7c3
Brendan feedback for robots.txt
exterkamp Feb 12, 2019
93a99bf
Brendan feedback on plugins.
exterkamp Feb 12, 2019
7b3fcb5
Brendan feedback for meta-desc, and manual seo audits.
exterkamp Feb 12, 2019
aa9bb0b
Brendan feedback for is crawlable and link text.
exterkamp Feb 12, 2019
62564d5
Brendan feedback for hreflang, canonical, http status code
exterkamp Feb 12, 2019
6dfbd5c
Added ticks to hreflang
exterkamp Feb 12, 2019
18a75ee
Brendan feedback font size and last part of robots.
exterkamp Feb 12, 2019
324db81
Update lighthouse-core/audits/seo/link-text.js
brendankenny Feb 12, 2019
5926722
Update lighthouse-core/audits/seo/manual/structured-data.js
brendankenny Feb 12, 2019
10cafea
Update lighthouse-core/audits/seo/manual/structured-data.js
brendankenny Feb 12, 2019
7294f93
Canonical fix maybe, and added suggestion changes to en-US.
exterkamp Feb 12, 2019
edea4fb
Feedback on canonical.
exterkamp Feb 12, 2019
b122256
removed toFixed(2). removed punctuation from canonical string. upda…
exterkamp Feb 12, 2019
2d36b31
changed displayValue naming
exterkamp Feb 12, 2019
4b692fa
Merge branch 'master' into i18n-seo
exterkamp Feb 14, 2019
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
2 changes: 1 addition & 1 deletion lighthouse-cli/test/smokehouse/seo/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = [
'font-size': {
rawValue: false,
explanation:
'Text is illegible because there\'s no viewport meta tag optimized for mobile screens',
'Text is illegible because there\'s no viewport meta tag optimized for mobile screens.',
},
'link-text': {
score: 0,
Expand Down
45 changes: 35 additions & 10 deletions lighthouse-core/audits/seo/canonical.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ 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 of a Lighthouse audit that provides detail on a page's rel=canonical link. This descriptive title is shown to users when the rel=canonical link is valid. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Title of a Lighthouse audit that provides detail on a page's rel=canonical link. This descriptive title is shown to users when the rel=canonical link is valid. */
/** Title of a Lighthouse audit that provides detail on a page's rel=canonical link. This descriptive title is shown to users when the rel=canonical link is valid. "rel=canonical" is an HTML attribute and value and so should not be translated. */

title: 'Document has a valid `rel=canonical`',
/** Descriptive title of a Lighthouse audit that provides detail on a page's rel=canonical link. This imperative title is shown to users when the rel=canonical link is invalid and should be fixed. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Descriptive title of a Lighthouse audit that provides detail on a page's rel=canonical link. This imperative title is shown to users when the rel=canonical link is invalid and should be fixed. */
/** Title of a Lighthouse audit that provides detail on a page's rel=canonical link. This descriptive title is shown to users when the rel=canonical link is invalid and should be fixed. "rel=canonical" is an HTML attribute and value and so should not be translated. */

failureTitle: 'Document does not have a valid `rel=canonical`',
/** Description of a Lighthouse audit that tells the user *why* they need to have a valid rel=canonical link. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Canonical links suggest which URL to show in search results. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/canonical).',
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by multiple URLs conflicting with each other. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by multiple URLs conflicting with each other. */
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by multiple URLs conflicting with each other. "urlList" will be replaced by a list of URLs (e.g. https://example.com, https://example2.com, etc ). */

explanationConflict: 'Multiple conflicting URLs ({urlList})',
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being invalid. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being invalid. */
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being invalid. "url" will be replaced by the invalid URL (e.g. https://example.com). */

explanationInvalid: 'Invalid URL ({url})',
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being relative instead of absolute. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being relative instead of absolute. */
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL being relative instead of absolute. "url" will be replaced by the problematic URL (e.g. https://example.com). */

explanationRelative: 'Relative URL ({url})',
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different hreflang than the current context. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different hreflang than the current context. */
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different hreflang than the current context. "href" will be replaced by the problematic URL (e.g. https://example.com). */

explanationPointsElsewhere: 'Points to another hreflang location ({href})',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still a URL, so may be good to use the same url replacement term as the other explanations (will need to update the description if changing this one)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this should still always be a url. Good point!

/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different domain. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different domain. */
/** [ICU Syntax] Explanatory message stating that there was a failure in an audit caused by a URL pointing to a different domain. "url" will be replaced by the problematic URL (e.g. https://example.com). */

explanationDifferentDomain: 'Points to a different domain ({url})',
/** Explanatory message stating that the page's canonical URL was pointing to a root of the same origin which is a common mistake. The canonical URL should point a different page with the same content whose URL is preferred, not a parent or root page. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing but my brain is tired from reviewing this PR now :) "root of the same origin" is the main thing that needs to be defined here (root directory and something about the origin...not sure if we have an existing origin we can reuse)

explanationRoot: 'Points to a root of the same origin',
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
};

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

/**
* @param {string} headerValue
Expand Down Expand Up @@ -62,10 +87,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 @@ -118,7 +142,7 @@ class Canonical extends Audit {
if (canonicals.length > 1) {
return {
rawValue: false,
explanation: `Multiple conflicting URLs (${canonicals.join(', ')})`,
explanation: str_(UIStrings.explanationConflict, {urlList: canonicals.join(', ')}),
};
}

Expand All @@ -127,14 +151,14 @@ class Canonical extends Audit {
if (!isValidRelativeOrAbsoluteURL(canonical)) {
return {
rawValue: false,
explanation: `Invalid URL (${canonical})`,
explanation: str_(UIStrings.explanationInvalid, {url: canonical}),
};
}

if (!URL.isValid(canonical)) {
return {
rawValue: false,
explanation: `Relative URL (${canonical})`,
explanation: str_(UIStrings.explanationRelative, {url: canonical}),
};
}

Expand All @@ -145,7 +169,7 @@ class Canonical extends Audit {
baseURL.href !== canonicalURL.href) {
return {
rawValue: false,
explanation: `Points to another hreflang location (${baseURL.href})`,
explanation: str_(UIStrings.explanationPointsElsewhere, {href: baseURL.href}),
};
}

Expand All @@ -154,7 +178,7 @@ class Canonical extends Audit {
if (getPrimaryDomain(canonicalURL) !== getPrimaryDomain(baseURL)) {
return {
rawValue: false,
explanation: `Points to a different domain (${canonicalURL})`,
explanation: str_(UIStrings.explanationDifferentDomain, {url: canonicalURL}),
};
}

Expand All @@ -163,7 +187,7 @@ class Canonical extends Audit {
canonicalURL.pathname === '/' && baseURL.pathname !== '/') {
return {
rawValue: false,
explanation: 'Points to a root of the same origin',
explanation: str_(UIStrings.explanationRoot),
};
}

Expand All @@ -175,3 +199,4 @@ class Canonical extends Audit {
}

module.exports = Canonical;
module.exports.UIStrings = UIStrings;
31 changes: 21 additions & 10 deletions lighthouse-core/audits/seo/font-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ const ViewportAudit = require('../viewport');
const MINIMAL_PERCENTAGE_OF_LEGIBLE_TEXT = 60;

const UIStrings = {
/** Imperative title of a Lighthouse audit that tells the user that they should use font sizes that are easily read by the user. This is displayed in a list of audit titles that Lighthouse generates. */
/** Title of a Lighthouse audit that provides detail on the font sizes used on the page. This descriptive title is shown to users when the fonts used on the page are large enough to be considered legible. */
title: 'Document uses legible font sizes',
/** Imperative title of a Lighthouse audit that tells the user that they should use font sizes that are easily read by the user. This imperative title is shown to users when there is a font that is too small to be read by the user. */
/** Descriptive title of a Lighthouse audit that provides detail on the font sizes used on the page. This imperative title is shown to users when there is a font that is too small to be read by the user. */
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
failureTitle: 'Document doesn\'t use legible font sizes',
/** Description of a Lighthouse audit that tells the user *why* they need to use a larger font size. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Font sizes less than 12px are too small to be legible and require mobile visitors to “pinch to zoom” in order to read. Strive to have >60% of page text ≥12px. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/font-sizes).',
/** [ICU Syntax] Label for the audit identifying font sizes that are too small. */
displayValue: '{decimalProportion, number, extendedPercent} legible text',
/** Explanatory message stating that there was a failure in an audit caused by a missing page viewport meta tag configuration. */
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
explanationViewport: 'Text is illegible because there\'s no viewport meta tag optimized ' +
'for mobile screens.',
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small. */
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small. "decimalProportion" will be replaced by a percentage between 0 and 100%. */

explanation: '{decimalProportion, number, extendedPercent} of text is too small.',
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small, based on a sample size of text that was less than 100% of the text on the page. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small, based on a sample size of text that was less than 100% of the text on the page. */
/** Explanatory message stating that there was a failure in an audit caused by a certain percentage of the text on the page being too small, based on a sample size of text that was less than 100% of the text on the page. "decimalProportion" and "decimalProportionVisited" will be replaced by percentages between 0 and 100%. */

explanationWithDisclaimer: '{decimalProportion, number, extendedPercent} of text is too ' +
'small (based on {decimalProportionVisited, number, extendedPercent} sample).',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
Expand Down Expand Up @@ -212,8 +220,7 @@ class FontSize extends Audit {
if (!hasViewportSet) {
return {
rawValue: false,
explanation:
'Text is illegible because there\'s no viewport meta tag optimized for mobile screens',
explanation: str_(UIStrings.explanationViewport),
};
}

Expand Down Expand Up @@ -287,16 +294,20 @@ class FontSize extends Audit {

let explanation;
if (!passed) {
const percentageOfFailingText = parseFloat((100 - percentageOfPassingText).toFixed(2));
let disclaimer = '';
const percentageOfFailingText = parseFloat((100 - percentageOfPassingText).toFixed(2)) / 100;
exterkamp marked this conversation as resolved.
Show resolved Hide resolved

// if we were unable to visit all text nodes we should disclose that information
if (visitedTextLength < totalTextLength) {
const percentageOfVisitedText = visitedTextLength / totalTextLength * 100;
disclaimer = ` (based on ${percentageOfVisitedText.toFixed()}% sample)`;
const percentageOfVisitedText = (visitedTextLength / totalTextLength).toFixed(2);
exterkamp marked this conversation as resolved.
Show resolved Hide resolved
explanation = str_(UIStrings.explanationWithDisclaimer,
{
decimalProportion: percentageOfFailingText,
decimalProportionVisited: percentageOfVisitedText,
});
} else {
explanation = str_(UIStrings.explanation,
{decimalProportion: percentageOfFailingText});
}

explanation = `${percentageOfFailingText}% of text is too small${disclaimer}.`;
}

return {
Expand Down
23 changes: 18 additions & 5 deletions lighthouse-core/audits/seo/hreflang.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ 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 of a Lighthouse audit that provides detail on the `hreflang` element on a page. This descriptive title is shown when the `hreflang` element is configured correctly. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Title of a Lighthouse audit that provides detail on the `hreflang` element on a page. This descriptive title is shown when the `hreflang` element is configured correctly. */
/** Title of a Lighthouse audit that provides detail on the `hreflang` attribute on a page. This descriptive title is shown when the page's `hreflang` attribute is configured correctly. "hreflang" is an HTML attribute and should not be translated. */

title: 'Document has a valid `hreflang`',
/** Descriptive title of a Lighthouse audit that provides detail on the `hreflang` element on a page. This imperative title is shown when the `hreflang` element is not valid and needs to be fixed. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Descriptive title of a Lighthouse audit that provides detail on the `hreflang` element on a page. This imperative title is shown when the `hreflang` element is not valid and needs to be fixed. */
/** Title of a Lighthouse audit that provides detail on the `hreflang` attribute on a page. This descriptive title is shown when the page's `hreflang` attribute is not valid and needs to be fixed. "hreflang" is an HTML attribute and should not be translated. */

failureTitle: 'Document doesn\'t have a valid `hreflang`',
/** Description of a Lighthouse audit that tells the user *why* they need to have an hreflang link on their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Description of a Lighthouse audit that tells the user *why* they need to have an hreflang link on their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
/** Description of a Lighthouse audit that tells the user *why* they need to have an hreflang link on their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. "hreflang" is an HTML attribute and should not be translated. */

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 +79,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 @@ -120,3 +132,4 @@ class Hreflang extends Audit {
}

module.exports = Hreflang;
module.exports.UIStrings = UIStrings;
23 changes: 18 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,20 @@ 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 of a Lighthouse audit that provides detail on the HTTP status code a page responds with. This descriptive title is shown when the page has responded with a valid HTTP status code. */
title: 'Page has successful HTTP status code',
/** Descriptive title of a Lighthouse audit that provides detail on the HTTP status code a page responds with. This imperative title is shown when the page responds to requests with an HTTP status code that indicates the request was unsuccessful. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Descriptive title of a Lighthouse audit that provides detail on the HTTP status code a page responds with. This imperative title is shown when the page responds to requests with an HTTP status code that indicates the request was unsuccessful. */
/** Descriptive title of a Lighthouse audit that provides detail on the HTTP status code a page responds with. This descriptive title is shown when the page responds to requests with an HTTP status code that indicates the request was unsuccessful. */

failureTitle: 'Page has unsuccessful HTTP status code',
/** Description of a Lighthouse audit that tells the user *why* they need to serve pages with a valid HTTP status code. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
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 +31,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 +67,4 @@ class HTTPStatusCode extends Audit {
}

module.exports = HTTPStatusCode;
module.exports.UIStrings = UIStrings;
23 changes: 18 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,20 @@ 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 of a Lighthouse audit that provides detail on the blocking status of their page in regards to search-engine index crawling. This descriptive title is shown when the page is not blocked from indexing and can be crawled. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Title of a Lighthouse audit that provides detail on the blocking status of their page in regards to search-engine index crawling. This descriptive title is shown when the page is not blocked from indexing and can be crawled. */
/** Title of a Lighthouse audit that provides detail on if search-engine crawlers are blocked from indexing the page. This descriptive title is shown when the page is not blocked from indexing and can be crawled. */

title: 'Page isn’t blocked from indexing',
/** Descriptive title of a Lighthouse audit that provides detail on the blocking status of their page in regards to search-engine index crawling. This imperative title is shown when the page has been configured to block indexing and therefore cannot be indexed by search engines. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Descriptive title of a Lighthouse audit that provides detail on the blocking status of their page in regards to search-engine index crawling. This imperative title is shown when the page has been configured to block indexing and therefore cannot be indexed by search engines. */
/** Title of a Lighthouse audit that provides detail on if search-engine crawlers are blocked from indexing the page. This descriptive title is shown when the page has been configured to block indexing and therefore cannot be indexed by search engines. */

failureTitle: 'Page is blocked from indexing',
/** Description of a Lighthouse audit that tells the user *why* they need to allow crawling on their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Description of a Lighthouse audit that tells the user *why* they need to allow crawling on their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
/** Description of a Lighthouse audit that tells the user *why* allowing search-engine crawling of their page is beneficial. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */

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 +78,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 @@ -135,3 +147,4 @@ class IsCrawlable extends Audit {
}

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

const UIStrings = {
/** Title of a Lighthouse audit that provides detail on the text descriptions used for links on the page. This descriptive title is shown when all links on the page have sufficient textual descriptions. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Title of a Lighthouse audit that provides detail on the text descriptions used for links on the page. This descriptive title is shown when all links on the page have sufficient textual descriptions. */
/** Title of a Lighthouse audit that tests if each link on a page contains a sufficient description of what a user will find when they click it. Generic, non-descriptive text like "click here" doesn't give an indication of what the link leads to. This descriptive title is shown when all links on the page have sufficient textual descriptions. */

title: 'Links have descriptive text',
/** Descriptive title of a Lighthouse audit that provides detail on the text descriptions used for links on the page, this is shown when links contain generic non-descriptive text like "click here". This imperative title is shown when one or more links on the page do not have enough text describing them to be considered valid when being crawled by a search engine. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Descriptive title of a Lighthouse audit that provides detail on the text descriptions used for links on the page, this is shown when links contain generic non-descriptive text like "click here". This imperative title is shown when one or more links on the page do not have enough text describing them to be considered valid when being crawled by a search engine. */
/** Title of a Lighthouse audit that tests if each link on a page contains a sufficient description of what a user will find when they click it. Generic, non-descriptive text like "click here" doesn't give an indication of what the link leads to. This descriptive title is shown when one or more links on the page do not have enough text describing them to be considered valid when being crawled by a search engine. */

failureTitle: 'Links do not have descriptive text',
/** Description of a Lighthouse audit that tells the user *why* they need to have descriptive text on the links in their page. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Descriptive link text helps search engines understand your content. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/descriptive-link-text).',
/** [ICU Syntax] Label for the audit identifying the number of links found. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** [ICU Syntax] Label for the audit identifying the number of links found. */
/** [ICU Syntax] Label for the audit identifying the number of links found. "link" here refers to the links in a web page to other web pages. */

displayValue: `{itemCount, plural,
=1 {1 link found}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any docs explaining how this format works

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other {# links found}
}`,
};

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

class LinkText extends Audit {
/**
Expand All @@ -26,10 +44,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', 'AnchorElements'],
};
}
Expand Down Expand Up @@ -70,8 +87,7 @@ class LinkText extends Audit {
let displayValue;

if (failingLinks.length) {
displayValue = failingLinks.length > 1 ?
`${failingLinks.length} links found` : '1 link found';
displayValue = str_(UIStrings.displayValue, {itemCount: failingLinks.length});
}

return {
Expand All @@ -83,3 +99,4 @@ class LinkText extends Audit {
}

module.exports = LinkText;
module.exports.UIStrings = UIStrings;
Loading