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

fix(gatsby): Reorder head tags #34030

Merged
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