Page 1 of 1

Naming the object ID

Posted: Fri Feb 14, 2025 12:24 pm
by VictorKrs
Hello!

I have questions about the site object IDs.:
1. Should the object's ID be unique within the page it is located in? Or should all site objects (i.e. on all pages) have unique IDs?
2. Please share your experience with naming site objects so that they are not too long, but on the other hand, it is clear what kind of object it is.

At the moment, I use the following naming system for objects:
The abbreviated name of the object type (lg, fg, fc, txt, img, bm, and so on)_the abbreviated name of the page_description of the object's purpose.
The result is (for example) the following: lg_catalog_products_header_group_products.
Everything is clear to me later in the process, but naming takes a lot of time and they get long. ☹
Please share your experience in this case!

Re: Naming the object ID

Posted: Fri Feb 14, 2025 12:35 pm
by Pablo
Should the object's ID be unique within the page it is located in?
Yes. This is a HTML requirement, otherwise they cannot be styled .
Or should all site objects (i.e. on all pages) have unique IDs?
No, each page does have it's own structure/styles.

Re: Naming the object ID

Posted: Fri Feb 14, 2025 12:49 pm
by VictorKrs
Thank you, Pablo!
So each page of the site can have an element with an ID equal to "products"?
I'm clarifying, because I doubt the correctness of the translation by an online translator

Re: Naming the object ID

Posted: Fri Feb 14, 2025 1:07 pm
by Pablo
So each page of the site can have an element with an ID equal to "products"?
Yes.

Note that this is not specific to WWB, it applies to HTML in general (like most features).

Re: Naming the object ID

Posted: Fri Feb 14, 2025 2:58 pm
by VictorKrs
OK! Got it! Thanks!