Limit description length to 160 in 1.6.4

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Limit description length to 160 in 1.6.4

Post by svasti » Tue Jul 29, 2014 4:09 pm

Hi developers,

I am just reading that Auntie Google says that the description should have no more than 160 chars. Would be nice if we could limit the field to 160, so that users stay conform to Googles wishes.

I'd rename the field in the language backend to "description (max 160 chars)"

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Tue Jul 29, 2014 7:17 pm

svasti wrote:Would be nice if we could limit the field to 160, so that users stay conform to Googles wishes.
I'm not sure. Other search engines have slightly different limits, AFAIK, and these limits might change over time, anyhow. And we have to consider what to do with existing descriptions that are longer than the limit.

Anyway, Google seems to present shorter descriptions sometimes, see e.g. "realblog_xh":
Realblog_XH ermöglicht die Präsentation eines Blogs auf Ihrer CMSimple_XH Website. Jeder Blog-Beitrag kann individuell kommentierbar ...
which are 133 characters, while cutting before the next comma ("gemacht werden") would have resulted in 148 characters.

Instead of imposing a strict limit, we may consider to better document the issue; AFAIK there is also no documentation regarding the (mostly?) pointless keywords. I've seen several sites where the keywords were set (not rarely a looong list), but the description defaulted to "Enter website description for search engine results here".

Anyway, I've put it on the roadmap.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Limit description length to 160 in 1.6.4

Post by svasti » Tue Jul 29, 2014 9:54 pm

We could instead of limiting the chars count have a counter. Otherwise it's difficult to know if one has exceeded Googles limit. You want google to use the description and not to abbreviate it with "...". How to know you exceeded the limit?
cmb wrote:And we have to consider what to do with existing descriptions that are longer than the limit.
Good point, so it would be better not to limit the chars but to have a counter, so that the user will see right away if he is over the top or not. That would have to be some javascript.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Tue Jul 29, 2014 10:18 pm

svasti wrote:Good point, so it would be better not to limit the chars but to have a counter, so that the user will see right away if he is over the top or not. That would have to be some javascript.
Good idea! Currently I'm writing the descriptions in a text editor to see the length, so this would be an improvement.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Sun Dec 28, 2014 8:41 pm

svasti wrote:That would have to be some javascript.
Indeed, but it shouldn't be hard. Basically, there has to be an event listener which recognizes all changes to the textarea. We already have that as part of XH.makeAutosize(), so it would make sense to factor out something like XH.addInputEventListener(textarea, listener). The listener would simply have to find out the character count:

Code: Select all

document.getElementById("meta_tags").elements.description.value.length
I'm not sure, though, where and how we should display the information. As part of the label ("Description (N characters):") it might be misleading. :?
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3587
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Limit description length to 160 in 1.6.4

Post by Tata » Sun Dec 28, 2014 9:26 pm

Right now I can't find it, but some years ago we discussed it with Gert in his RealBlog. There was tested a counter just below the textarea set as a countdown showing chars left to the pre-set limit.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Sun Dec 28, 2014 9:40 pm

Tata wrote:Right now I can't find it, but some years ago we discussed it with Gert in his RealBlog. There was tested a counter just below the textarea set as a countdown showing chars left to the pre-set limit.
Ah, interesting! I assume that was when Realblog had a textarea for the teaser, and a WYSIWYG editor only for the full article (Realblog_XH <= 1.3, or so).

Anyway, I'd rather not count down from some given limit, but count up from 0 and let the user decide how much text to write.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3587
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Limit description length to 160 in 1.6.4

Post by Tata » Sun Dec 28, 2014 11:04 pm

cmb wrote:Anyway, I'd rather not count down from some given limit, but count up from 0 and let the user decide how much text to write.
Well, but mostly there are limits for texts in various engines. In this case it would be fine if one can see how many characters are left. There is no advantage to say how many character I want write if there is some limit that I am not aware of. In the countdown counter I see on the beginning how many I can use.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Sun Dec 28, 2014 11:22 pm

Tata wrote:Well, but mostly there are limits for texts in various engines.
Yes, but these limits seem to vary between search engines, and are not necessarily known[1]. Telling the user "you have N characters left", even though we can only roughly estimate the limit, seems wrong to me. IMO it's better to leave the final decision to each user.

[1] For instance, I've read several times that the number of characters of the meta description should not exceed 160 or 156 for Google. However, we're using Unicode, so it's not clear, whether that is measured in code points or graphemes. And now I found an article on sistrix.de, and they are saying that Google actually measures pixel based (consider the difference between "i" and "m").
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Limit description length to 160 in 1.6.4

Post by cmb » Sat Jan 10, 2015 1:16 pm

I have implemented the basic character (actually, code point) counting mechanism (r1449). The presentation can obviously be improved -- any suggestions? Those who do not have an SVN client available can get a snapshot of a certain revision from SourceForge: http://sourceforge.net/p/cmsimplexh/code/1449/tarball (replace 1449 with the revision you're looking for).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply