Skip to content

Instantly share code, notes, and snippets.

@wigman
Last active April 29, 2024 07:50
Show Gist options
  • Save wigman/12f1008d11bc172b67afb1c75b8d178d to your computer and use it in GitHub Desktop.
Save wigman/12f1008d11bc172b67afb1c75b8d178d to your computer and use it in GitHub Desktop.
hyva.io speculation rules
<script>
if (HTMLScriptElement.supports &&
    HTMLScriptElement.supports('speculationrules')) {
  const specScript = document.createElement('script');
  specScript.type = 'speculationrules';
  specRules = {
    "prerender": [{
"source": "document",
"where": {
"or": [
{ "href_matches": "/" },
{ "href_matches": "/*.html" },
{ "href_matches": "/blog*" },
{ "href_matches": "/*-feature-matrix/" },
{ "href_matches": "/(about|partners|press-kit|ppp-discount|suppliers|license|showcases)/" }
],
},
"eagerness": "moderate"
}]
  };
  specScript.textContent = JSON.stringify(specRules);
  document.body.append(specScript);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment