Skip to content

Commit

Permalink
fix(gatsby): Reorder head tags (#34030)
Browse files Browse the repository at this point in the history
* group head tags and reorder and spread

* move tag ordering to static-entry

* change reduce to sort

* comment purpose of headComponents sort
  • Loading branch information
graysonhicks authored Dec 17, 2021
1 parent d163724 commit 10c8227
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/gatsby/cache-dir/static-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@ export default async function staticPage({

postBodyComponents.push(...bodyScripts)

// Reorder headComponents so meta tags are always at the top and aren't missed by crawlers
// by being pushed down by large inline styles, etc.
// https://github.com/gatsbyjs/gatsby/issues/22206
headComponents.sort((a, b) => {
if (a.type && a.type === `meta`) {
return -1
}
return 0
})

apiRunner(`onPreRenderHTML`, {
getHeadComponents,
replaceHeadComponents,
Expand Down

0 comments on commit 10c8227

Please sign in to comment.