Site logo

Archived topic

How can I avoid the superfluous creation of uniqueIDs and classes?

5 replies · Started by Betina Graf on February 7, 2023

Viewing posts 1–6 of 6

Hello everyone!

We are currently building a website that shows many sayings and quotes with corresponding pictures. I want the output of the code of this picture text compound to be as slender and simple as possible. The design of the pictures is defined centrally in the Global Styles. However, each combination …

1) initially creates its own uniqueID (in the example: "9e9aad85")
2) creates another uniqueID at the picture (in the example: "5a2cde0f")
3) creates yet another class, which receives its own combination of letters and numbers each time (in the example: "gb-image-5a2cde0f")

This is an example of such code:

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:generateblocks/container {"uniqueId":"9e9aad85","paddingSyncUnits":true,"isDynamic":true,"blockVersion":2,"useGlobalStyle":true,"globalStyleId":"spruchbild-links","globalStyleLabel":"spruchbild-links"} -->
<!-- wp:generateblocks/image {"uniqueId":"5a2cde0f","mediaId":4759,"sizeSlug":"full","globalStyleLabel":"spruchbild"} -->
<figure class="gb-block-image gb-block-image-5a2cde0f"><img class="gb-image gb-image-5a2cde0f" src="https://gruesse-wuensche.de/wp-content/uploads/guten-morgen-spruch-wie-eine-uhr.jpg" alt="Eine Uhr für den Spruch: Ich bin wie eine Uhr" title="Spruch: Ich bin wie eine Uhr"/></figure>
<!-- /wp:generateblocks/image -->
<!-- /wp:generateblocks/container --></div>
<!-- /wp:column -->

<!-- wp:column -->
<div class="wp-block-column"><!-- wp:quote {"className":"zitat-autor"} -->
<blockquote class="wp-block-quote zitat-autor"><!-- wp:paragraph {"className":"zitat-medium"} -->
<p class="zitat-medium">Ich bin wie eine Uhr,<br>die sich jeden Tag von neuem<br>richten muss, weil sie jeden Tag<br>immer wieder von neuem nachgeht.</p>
<!-- /wp:paragraph --><cite>Christian Morgenstern</cite></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>Humorvoller Guten-Morgen-Spruch für Tage, an denen man sich erst mal wieder zurecht finden muss. Tipp: gut geeignet für WhatsApp, wenn Sie sich einmal verspäten.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"className":"sprueche-id"} -->
<p class="sprueche-id">Spruch-ID: 1923</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

If I remove these 3 superfluous elements manually, I'll receive an error message upon pasting the code again, since WordPress seems to expect this information.

Could you please help me to find out if – and if so, how – I can remove these uniqueIDs and superfluous class in a way that will not result in an error message?

Best wishes,
Betina

Hi there,

thats not possible, those uniqueIDs are required to maintain block settings in the editor and to generate related CSS.

What is the issue they are causing ?

Hello David,
the text to HTML ratio is very low, and I do not need these uniqueIDs, because the CSS of all images is the same and the pages do not need an own design for every image. So these superfluous IDs only bloat the source code.
I do not really understand why every image needs a different uniqueID.
Best regards,
Betina

The IDs are present not just for the styles, but that individual blocks settings in the editor.
And today there is no way to change that,

In future versions we are looking at new Global Styles in GB Pro, where this kind of change will be possible. But today it is not.

Ah, I understand, thank you very much for your explanation!

You're welcome :)

This archived topic is closed to new replies.