shinsenter / defer.js

🥇 A lightweight JavaScript library that helps you lazy load (almost) anything. Defer.js is dependency-free, highly efficient, and optimized for Web Vitals.
https://shinsenter.github.io/defer.js/
MIT License
277 stars 45 forks source link

sitemap issues #125

Closed radobotev closed 11 months ago

radobotev commented 11 months ago

Hey, I'm having some issues with Google indexing my sitemaps when this plugin is active, not sure if anyone has reported it but I had the plugin switched off for a few days and Google indexed my sitemaps on search console fine.

24 hours later, I activated the plugin again and the sitemaps were not indexed by Google search console.

I have now disabled all optimising options, except the lazy load for images, because it works great, just to see if Google will do the exact same thing, I think it will, because I have another problem with Yoast SEO when I try to optimise my newest content manually, I am getting the error that's shown below:

<!DOCTYPE html>
<html class="no-deferjs">
<head><meta name="generator" content="[defer.php](https://code.shin.company/defer.php)"></head>
<body><p>{"objects":[],"next_url":false}</p></body>
<!--
site name
-->
</html>

Could you please advise on what this issue might be as I love the plugin and its optimisation features and it has been working fine for me for years, until the 20th of August this year when everything just went downhill?

shinsenter commented 11 months ago

@ps2master Thank you for reaching out. Could I have more specific information about the error you believe my plugin is causing? Regarding the HTML snippet you've posted and consider it an error message, it's challenging for me to pinpoint the cause since you haven't provided me with the complete HTML of the webpage.

May I request two full HTML versions of your website, one with my plugin enabled and one with it disabled? If it's related to the content of the sitemap.xml file, I also need to know which plugin you're using to generate the sitemap.xml, as well as the contents of the sitemap.xml file when it's generated with my plugin enabled and disabled. I need to compare the differences and provide a more accurate assessment of your issue.

By the way, this is the place to discuss issues related to my WordPress plugin. https://github.com/shinsenter/defer-wordpress/issues If you don't mind, please create an Issue here and provide me with more details about your problem.

Best regards

shinsenter commented 11 months ago

@ps2master

I've just released a new version of the plugin. Would you mind taking a look to see if it can address your issue? Your feedback is greatly appreciated.

If you find this plugin valuable, please consider leaving a 5-star review (⭐️⭐️⭐️⭐️⭐️).

Best regards.

radobotev commented 11 months ago

Hey, just installed the new update, ran my usual Yeast SEO optimisations and the error was gone, thank you! I will just wait for Google to index the sitemaps again now and will report back.

radobotev commented 11 months ago

Sitemaps are also indexing without problems again, thank you for being so efficient and fixing the issues so quickly.

shinsenter commented 11 months ago

@ps2master It's great to know that the new version has addressed your issue!

AlphhHue commented 9 months ago

Hello, I got the samedi issue here with /feed/ and /wp-json/

Example for a wp-json request, i got this result :

<html class="no-deferjs">
<head><meta name="generator" content="[defer.php](https://code.shin.company/defer.php)"></head>
<body><p>[{"id":20,"name":"Name of entity"}]</p></body>
</html>

Same on the /feed/ that beginning by:

<html class="no-deferjs">
<head><meta name="generator" content="[defer.php](https://code.shin.company/defer.php)"></head>
<body><p>

It broke the result :-(

Version 2.6.0

Thanks for your help

AlphhHue commented 9 months ago

Add : "|| stripos($_SERVER['REQUEST_URI'], 'feed') !== false || stripos($_SERVER['REQUEST_URI'], 'wp-json') !== false" to is_wplogin in includes/class-defer-wordpress.php and it work fine now.

I can only think that you did not anticipate this case given the quality of the module and your work, so I find it surprising!