- This topic has 8 replies, 3 voices, and was last updated 3 years, 3 months ago by
Fernando.
-
AuthorPosts
-
March 15, 2023 at 1:58 pm #2569095
Gonzalo
Hi
I added the following code I found here to add width and height attributed to logo on my website since it is an SVG file and it was causing a CLS issue on Page Speed Insights
add_filter(‘generate_logo_attributes’, function($output){
$add_attr = array(
‘width’ => ‘200’,
‘height’ => ’56’,
);
$new_output = array_merge($output,$add_attr);
return $new_output;
});It is working for the whole website but not on the homepage for some reason.
I am using a merge element for the homepage to display a transparent header.Is there anything I need to update for the above code to work on the homepage’s logo as well?
The SVG file for the logo is the same in the home page as in the rest of the website so not sure why this is not working.
Thanks much
March 15, 2023 at 2:41 pm #2569109Leo
StaffCustomer SupportHi there,
Can you add the code above again and then replace
generate_logo_attributeswithgenerate_page_hero_logo_attributes?Let me know 🙂
March 15, 2023 at 2:52 pm #2569116Gonzalo
Hi
I did add that code you suggested as a new snippet but it is not working unfortunately.Do I need to add that additional code to the same code snippet I am using for the other pages or was setting it up as a new snippet correct?
March 15, 2023 at 3:04 pm #2569128Gonzalo
I added it to the same snippet and as a separate snippet and either way the home page logo still having issues
March 15, 2023 at 3:26 pm #2569154Leo
StaffCustomer SupportSorry – let’s take a small step back first.
I just noticed that the logo for the home page is the same as all other pages – is there a specific reason why an extra page hero logo is needed here? The appearance should be exactly the same without it.
Let me know if I’m missing something here.
March 15, 2023 at 3:31 pm #2569159Gonzalo
I did a page hero because all other pages on the website have a black header background and in the home page I wanted it to be transparent backgound on top of the image of the first container.
March 15, 2023 at 3:44 pm #2569167Leo
StaffCustomer SupportI understand why the page hero/transparent header is needed but I don’t believe a separate logo is needed.
You would only use the page hero logo field if you want a different logo with a transparent header.
For example: https://docs.generatepress.com/article/navigation-as-a-header/#different-logo-and-navigation-colorsIn your case, it’s the white logo with or without the transparent header so it shouldn’t be needed.
Let me know if this makes sense 🙂
March 15, 2023 at 3:53 pm #2569176Gonzalo
Oh got it! that worked, I just removed the page hero logo and now the logo displays ok and has dimensions all over the site.
However, and I am so sorry to bother you, my page still has some serious CLS issues and I thought it was the logo but it is not (since now I fixed that).
Do you have any ideas what could be causing the huge CLS on home page. Page Speed Insights shows the issue is mostly on desktop.
March 15, 2023 at 5:24 pm #2569227Fernando Customer Support
Hi Gonzalo,
I tried testing your site multiple times and I’m not getting any significant CLS issues. The CLS score I’m getting is almost perfect. See: https://share.getcloudapp.com/YEue12kd
The other issues seem to stem from your Server’s response time and Javascript from your plugins.
Can you try testing again?
-
AuthorPosts
- You must be logged in to reply to this topic.