I have a query. My site is very excellent in its performance
But there is a problem that I discovered recently, which is that most of the pages of my site show that the percentage of code is more than text
Meaning, for example, the home page (attached to the link), its text size = 4 KB and code size = 140 KB
The same applies to many pages and posts
And the scaling of the text size to the code is important now for me. I want to reduce the size of the code, and I think it is mainly due to the theme
Do you have any solutions for this matter?
A GP user perfectly explained the reason for this issue:
“Your text-to-HTML ratio indicates the amount of actual text you have on your webpage compared to the amount of code. This issue is triggered when your text-to-HTML ratio is 10% or less.
Search engines have begun focusing on pages that contain more content. That’s why a higher text-to-HTML ratio means your page has a better chance of getting a good position in search results.”
As a note, GeneratePress doesn’t inherently add that much HTML. HTML size corresponds to how a page is built and how your plugins affect it.
The HTML added by GeneratePress and GenerateBlocks is optimized and minimal to achieve your design. You also have a form that seems to be adding a bunch of HTML.
What I would primarily recommend to avoid the issue on the link you shared is to increase the text on the page or remove or try to use a different form.
So let’s see another page
This is a post page that does not contain any forms or plugins to design
It is completely designed by GP and GB
What is your interpretation? Text size = 4 KB and code size = 143 KB
you can you remove some of the excess code that WordPress adds such as the Duotone image effects and global styles with these snippets:
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' ); remove_action( 'render_block', 'wp_render_duotone_support', 10 ); remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' ); remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
Might be worth checking if Perfmatters has those options in it settings too.
CSS styles you have plugins that optimize some of your CSS and they are inlining it in the head of your site. And this will be counted in the HTML document size.
You have also have inline scripts on the site. And their HTML counts here too,
And then there is all the meta tags, OpenGraph, JSON+LD Schema that you have on the site too. Thats also in your HTML.
There is very little that GP or GB adds. Wherever possible we try to add only what is required. If you want to remove the HTML that we add then you would need to remove things like the navigation or the footer.
The issue you have is those pages have very very few words. So the Ratio is always going to be a problem. And the HTML to Text Ratio metric should only really matter when you have a large Text size – not 4kb….
Let me repeat the points I mentioned as per my understanding of them
1- You want me to add the code that you wrote to my site
2 – You say that the plugin I use to improve may be one of the reasons for the increased code size
3 – You say that the HTML to Text Ratio is important only when my page is large and not in its current state?
Is that true or not
1. I mentioned, check the Perfmatters options. And I found this:
So you don’t need the code, you can just check the perfmatters option.
2. The plugins are not increasing the code, they are simply moving code from on external stylesheet to inline HTML. The code would need to be loaded regardless. And inlining CSS can can load faster and remove render blocking issues. The weigh off is that it gets counted in your HTML.
3. On pages with a low word count the ratio will always be distorted.
IF you had a 3% ratio on a page with 20kb of text ( 2000+ words ) then this would be around 600kb of code, and that could make a noticeable impact on loading performance.
But that would not be the case, if you added 5x the text to that page, the HTML increase would be negligible as it would only be the extra tags that the content requires – it would still be around 140kb.
So the argument here is whether 140kb of code is a lot of code and causing a problem.
When you consider the code accounts for this:
site header, footer, main container a 20+ item navigation, WPML scripts, Ivory Search scripts, Meta tags, OpenGraph, JSON+LD Schema, Analytics, content HTML including images on the page, Social Sharing, Comments form and any inline CSS/JS.
I think we can agree 140kb ( Uncompressed ) is a tiny amount of code.
If that code size was an issue then performance checkers would highlight it, such as unused code, excessive dom sizes etc…. and there is no evidence of that.
- You must be logged in to reply to this topic.