Additional Notes
To add basic URLs you can simply append to the array. For more complex speculative rules, you can copy the metadata.php file to the child theme.
The array starts with the homepage by default, but that can be removed or reset as you like.
PHP
add_filter(‘nebula_speculative_preload_pages’, function($urls){ $urls[] = ‘/about-us/’; //Simply add a url to the array //Add certain pages based on the current page if ( is_page(1224) ){ //Example product detail page $urls[] = ‘/products/’; $urls[] = ‘/where-to-buy/’; } return $urls; //Always return in a filter! });
Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API
Browser Support: https://caniuse.com/mdn-html_elements_script_type_speculationrules
Please note that Nebula does preload links on hover, which this JSON can also natively support. See the documentation for those details.