Try our conversational search powered by Generative AI!

Inline block - unique identifier?

Vote:
 

With the new inline blocks, how would we find a unique id for it? Something like:

((IContent)block).ContentGuid

or ContentLink.ID will fail because these blocks are not IContent instances.
It's not like I can't generate something myselft, but it's a problem with existing code where this is used to output unique identifers in HTML.. 

#305839
Jul 28, 2023 6:21
Vote:
 

Inline blocks inside ContentArea do not have a unique id, they are part of the page.

#305840
Jul 28, 2023 6:55
Vote:
 

Hi Arjan,

Inline blocks do not inherit IContent which would give you the ability to use your above code. They are stored in a property bag.

However that doesn't mean you can't get a unique id.

The method I would alternatively use is a custom content area render. 

The custom content area render would give you a list of each of the items in the content area. I can only presume each inline block has its own property bag with a unique identifier otherwise how is this done in the admin screen.

Once you have the unique id from the property bag you can append this to the block that is rendered.

This is untested, so take this with some caution.

Paul

#305842
Jul 28, 2023 7:40
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.