Skip to content

Commit

Permalink
core(hreflang): use Audit.makeNodeItem (#12273)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Mar 20, 2021
1 parent 6ab868b commit 5cf41cd
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lighthouse-core/audits/seo/hreflang.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@ class Hreflang extends Audit {
}

if (link.source === 'head') {
source = {
type: 'node',
snippet: `<link rel="alternate" hreflang="${link.hreflang}" href="${link.hrefRaw}" />`,
path: link.node !== null ? link.node.devtoolsNodePath : '',
selector: link.node !== null ? link.node.selector : '',
nodeLabel: link.node !== null ? link.node.nodeLabel : '',
};
if (link.node) {
source = {
...Audit.makeNodeItem(link.node),
snippet: `<link rel="alternate" hreflang="${link.hreflang}" href="${link.hrefRaw}" />`,
};
} else {
source = {
type: 'node',
snippet: `<link rel="alternate" hreflang="${link.hreflang}" href="${link.hrefRaw}" />`,
};
}
} else if (link.source === 'headers') {
source = `Link: <${link.hrefRaw}>; rel="alternate"; hreflang="${link.hreflang}"`;
}
Expand Down

0 comments on commit 5cf41cd

Please sign in to comment.