renatomarinho/laravel-page-speed

TrimUrls is removing necessary information for JSON-LD

ahmadalfy opened this issue · 1 comments

This class remove the URL scheme from everywhere.

\RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,

This renders the JSON-LD object invalid and stop Google from properly indexing your rich snippets.

<script type="application/ld+json">
{  
   "@context":"http://schema.org",
   "thumbnailUrl":"http://sampleurl"
}
</script>

Become this:

<script type="application/ld+json">
{  
   "@context":"//schema.org",
   "thumbnailUrl":"//sampleurl"
}
</script>

It should automatically exclude these parts

Hi!

Trimming URLs is considered medium risk. It can cause problems if it uses the wrong base URL.
References ( #61 #60 #53 ).

In your case, do not register: \RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class

Soon we will be updating the documentation of the package, leaving more explicit the risks that each filter can cause.