-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(meta): refactor all meta audits to single artifact #7025
Conversation
@@ -199,7 +199,7 @@ class FontSize extends Audit { | |||
title: str_(UIStrings.title), | |||
failureTitle: str_(UIStrings.failureTitle), | |||
description: str_(UIStrings.description), | |||
requiredArtifacts: ['FontSize', 'URL', 'Viewport'], | |||
requiredArtifacts: ['FontSize', 'URL', 'MetaElements'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changes to functionality needed here because it just calls out to the viewport audit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's unavoidable, but are we setting ourselves up for ballooning the size of the artifacts? People put crazy things in meta tags sometimes.
We could have a list of allowed meta names and add the ones we need as we go. On the other hand, that would prevent plugins from being able to just use the meta tags they're interested in without getting changes landed in core.
types/artifacts.d.ts
Outdated
MetaDescription: string|null; | ||
/** The value of the <meta name="robots">'s content attribute, or null. */ | ||
MetaRobots: string|null; | ||
/** The value of the <meta>elements in the head. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -12,7 +12,7 @@ | |||
<!-- FAIL(font-size): missing viewport --> | |||
<meta name="viewport" content="invalid-content=should_have_looked_it_up"> | |||
<!-- no <meta name="description" content=""> --> | |||
<meta name="robots" content="nofollow, NOINDEX, all"> | |||
<meta name="RoBots" content="nofollow, NOINDEX, all"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document the reason for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -43,13 +43,13 @@ class ThemedOmnibox extends MultiCheckAudit { | |||
} | |||
|
|||
/** | |||
* @param {LH.Artifacts['ThemeColor']} themeColorMeta | |||
* @param {LH.Artifacts['MetaElements'][0]|undefined} themeColorMeta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make an alias of LH.Artifacts.MetaElement
since we use this so often?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only usage of it, but sure :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only usage of it, but sure
ha, whoops
it('fails when viewport is not set', () => { | ||
const artifacts = { | ||
URL, | ||
Viewport: null, | ||
MetaElements: makeMetaElements(null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the conditional in makeMetaElements
just for this case? null
could just be undefined
or this one could just be []
an no conditional needed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
@@ -78,7 +80,7 @@ describe('SEO: Is page crawlable audit', () => { | |||
const artifacts = { | |||
devtoolsLogs: {[IsCrawlableAudit.DEFAULT_PASS]: devtoolsLog}, | |||
URL: {finalUrl}, | |||
MetaRobots: null, | |||
MetaElements: makeMetaElements(null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch to no argument or just use []
and no function call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
@@ -94,7 +94,7 @@ describe('Config', () => { | |||
const configJson = { | |||
passes: [{ | |||
passName: unlikelyPassName, | |||
gatherers: ['viewport'], | |||
gatherers: ['meta-elements'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the number of times I've used viewport
as a dummy gatherer name :)
FWIW, I'm not really worried about this. Of all the artifact size concerns, we know these artifacts have to be constrained to roughly the size of the page. trace/devtoolslog/screenshots are always going to dwarf this.
This limitation would kinda defeat the purpose of having generic gatherers IMO, would it not? Seems like if we just limited to what we needed then it's no different from the position we were in before functionality-wise. |
@brendankenny LGTY? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Replace all our scattered meta gatherers with a single
MetaElements
artifact.Related Issues/PRs
#6747