Maybe it could be a good idea to rename the headContributions HST tag?

As I am new to Bloomreach I am following the tutorials, currently I am on this step:

It feels weird to have a tag called 'headContributions which has categories which can indicate to NOT add it to the html after all? Maybe you could call it ‘hst.clientLib’ instead? I also work with Adobe Experience Manager, so to me that feels like a more logical name for a tag which contains CSS and/or JS.

If you opt for something like this, I guess it would be a good idea to support both for a while but only use the new name in tutorials and remove the old one after a while.

1 Like

The headContributions tag works with the headContribution tags. So it is named to indicate that relation. The intent is to allow sub components to inject elements into the head. It is slightly misnamed however, as there is no requirement for this tag to be in the head. It is often used to inject on the bottom of the page.

The categoryExcludes and categoryIncludes then perhaps become clearer. The excludes will inject all contributions except the ones listed. The includes will only use the ones listed. So you could:

<html>
   <head>
    <hst:headContributions categoryExcludes="scripts"/>
   </head>
...
    <hst:headContributions categoryIncludes="scripts"/>
</html>

This way you inject all contributions at the top, except the ones that are marked as scripts.

The “head” part is a bit misleading, but the contributions are spot on. It isnt correct to call it clientLib, you can only inject an html element. This can be a script or reference to a script or any other html element, but it isn’t a library.

clientLib was just a suggestion, you just as well can call it
frontendContributions
elementContributions
HTMLContributions

I understood the concept already, but thank you for elaborating on its functionality.

In AEM it is called a clientside-library because:

  1. It is a collection of static resources (css, js, images) and therefore they call it a library. Just like here you can opt to include only css or js using a tag attribute. Which just like in your case results in the inclusion of a HTML element. Although in AEM they divide all static resources into categories which often correspond to their CMS components, but can just as well be custom names for a set of 3rd party resources you want to embed into your site. You then have the option to include only specific sets of static resources (which allows for a more granular approach) and they will eventually be concatenated into one element for performance reasons. I don’t know yet if in Bloomreach each hst:headContributions will result in a separate html element being added?

  2. The client-side in the name is obvious because css and js are processed by the browser.

So, we seem to disagree on the fact that the name clientLib is applicable as in my view it refers to the set of static resources while you focus more on the end result of the html element, but It seems you agree with me on my main point and all the rest is name nitpicking in my view. Maybe you can host a poll on it :grinning: