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

Turbo recreates link elements in head on every page transition #719

Closed
derSascha opened this issue Sep 16, 2022 · 0 comments · Fixed by #752
Closed

Turbo recreates link elements in head on every page transition #719

derSascha opened this issue Sep 16, 2022 · 0 comments · Fixed by #752

Comments

@derSascha
Copy link

Thanks for the great turbo project!

The HTML head section might contain link elements like favicons and preload. Turbo replace them on every transition and browsers reloading them in that case. Depending on the browser and privacy settings, this results in local cache or additional fetch request. Turbo should handle them like scripts, compare the signature and only remove/create them on changes.

Example HTML:

<html>
  <head>
    <link rel="shortcut icon" href="/some-icon.png" />
    <link rel="preload" as="font" type="font/woff2" href="/some-font.woff2" />
    ....

Not sure if there is a way to create a workaround. The turbo:before-render event provides only access to the body and not the head. Any suggestions how to handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant