soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
314 stars 29 forks source link

xlink stylesheet links being added to source code in some cases #2093

Open infinitnet opened 3 years ago

infinitnet commented 3 years ago

This bug exists in all Oxygen Builder versions. In some cases (potentially when Oxygen pages were converted to Gutenberg), this is being added to the source code:

<link rel='stylesheet' id='oxygen-styles-1234-css'  href='https://example.com/page/?post_id=1234&#038;xlink=css&#038;nouniversal=true&#038;ver=5.7' type='text/css' media='all' />

This doesn't only negatively impact performance, but since these links are also crawlable by Googlebot and other search engine spiders, this also negatively impacts SEO.

I reported this bug including a fix in October 2020, but unfortunately the Oxygen team hasn't been able to take a few minutes to apply the fix to any of their updates so far.

With page performance officially becoming a critical ranking factor in May 2021 (https://developers.google.com/search/blog/2020/11/timing-for-page-experience), this is a reason to be concerned for Oxygen users affected by this issue.

My current fix (thanks to @Lupul) is to add this function:

function array_filter_rec($array) {

    return array_filter($array, function($item) {

        if(is_array($item)) {
            return !empty(array_filter_rec($item)); // checks unlimited recursion depth
            // return array_filter($item); // Filters first nested level
        }

        return !empty($item);

    });

}

and change array_filter to array_filter_rec in /oxygen/component-framework/includes/cache.php line 324.

Spellhammer commented 3 years ago

I reported this bug including a fix in October 2020, but unfortunately the Oxygen team hasn't been able to take a few minutes to apply the fix to any of their updates so far.

I couldn't find a bug report from you previously regarding this issue. Could you please provide replication steps here so that we can be sure to take a look?

Please also clarify whether this bug occurs for you when Oxygen's CSS Cache is enabled or not.

infinitnet commented 3 years ago

@Spellhammer I've reported this by email (subject "Query strings being appended to CSS files (Reason: Something's broken and I need help)") on 2020-08-21 and after some back and forth the conclusion was that "there is no easy fix". I then hired @Lupul who came up with the fix above which is indeed quite easy. If you can look up that email thread, you can find everything you need in that lengthy conversation. It was forwarded to the dev team as well apparently and I also got a confirmation that it was added to the internal bug tracking. The last update I received on October 7th 2020 was "Our developer has let me know that the fix suggested by your developer makes sense and he has updated our internal bug report with the information from your ticket." and then it was never applied to your code base and I did follow up twice.