How to calculate the ratio of text to "HTML" ("HTML ratio")?

Asked

Viewed 1,084 times

9

The text of an "HTML ratio" refers to the amount of text on a page against the code of the same page.

How to do this calculation, I know I should probably take the DOM, but the part exactly what elements and how the field works?

  • 2

    http://www.sitepoint.com/dom-monster-bookmarklet-tool/

  • 2

    Almost the answer, it was really easy to understand, very grateful :) - I will try to implement here and maybe soon I post a response.

1 answer

10


What is HTML Ratio or HTML Text Ratio?

HTML ratio is nothing more than the percentage of actual text on your html page.
On an HTML page we have Text and HTML Code, the apportionment is the percentage of text on the page (code + real text). A simple rule of three would be:

code  ------- 100%
textoReal --- x

ratio = x;

For example, when loading a page it is 80kb in size. When calculating the texts on this page, we can see that of this 80kb, 60kb is only code (html tags, and everything else written that is not plain text) and real text it is only 20kb. So we would have 20% text. This is our Code Rate.

 80 ------- 100%
 20 ------- x

 ratio = (20 * 100) / 80;
 ratio = 25%;   

Okay, I know what that is, but what use is that?

Well, some search engines use html ratio to index your site.
If a better position on Google were not enough, for example, having a good apportionment helps in SERP’s (The way your page appears, usually the title and two or three lines of description).

And how do I calculate this on my website?

So, making your own tool to calculate can take a little work, and it might not be feasible for you. An alternative would be to use some services, such as the Dom Monster that the @Luizvieira commented, or some others, such as Seochat and the Smallseotools.

But how much is suitable for my site?

There is no standard to be followed, because it is not known what the search algorithm is like and what it uses to index the pages, but the advised is somewhere around 20 to 80% of your page.

Okay, I’ve changed the rate of my page to the percentage, now my site will be the first?

No, the text apportionment is only one of the factors for indexing, and it is not used by all mechanisms, and the relevance of it is not known. The best to ensure a good place, is to have a good content and apply the other practices of that exist.

Remember that in the same way you apply seo, other programmers also apply. Not only use seo on your site that will ensure a good indexing.

  • What I have been reading and testing, in most pages the percentage is below 20%, this due to menus and frameworks like Bootstrap that sometimes makes us need to use more tags, with this and adding Googleanalitycs, Googlemaps (which generates several elements) and Google conversions will hardly exceed 20%.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.