Skip to content

Commit

Permalink
Move <link rel="prefetch" ...> from <head> to <body>
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Feb 17, 2021
1 parent 6e01189 commit 155b57d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ function getHeadAndBodyChunks(chunks) {
const bodyChunks = [];

chunks.forEach(chunk => {
if ((chunk.attributes.src && chunk.attributes.src.includes("_head")) || chunk.attributes.href) {
if ((chunk.attributes?.src && chunk.attributes.src.includes("_head"))
|| (chunk.attributes?.href && chunk.attributes?.rel !== 'prefetch')
) {
headChunks.push(chunk);
} else {
bodyChunks.push(chunk);
Expand Down

0 comments on commit 155b57d

Please sign in to comment.