Access Valuelist-Label in a faceted Navigation

Is there an easy way to render the label of a value-list in facet ?


You can make a value list available in site:

thx so far!
is that the only way? I would need it also in the facet-navigation-component.
In that case I would either need multiple Components (for each faceted nav) or I would have to inject all valuelists (cuurently 3) to one extended component (allthough I do not need all values everywhere) .


Well, the documentation explains how to fetch the value lists in an hst component. If you need it in multiple components you have to figure out a way to structure your page config (and corresponding java classes). One thing you can do is indeed inject this everywhere, maybe a class attached to hst:abstractpages/base.
If you are worried about performance dont, since value lists are cached in memory anyway. (Unless you have huge value lists, but then your problem would show in other forms :slight_smile: )

ok - i will give it a try :slight_smile:

I tried to inject the valuelist into hst:abstractpages/base - but the request-parameter is not available in nested templates (only in the base-template). The class is called :frowning:

Should it be accessible ? Or do I have to add it to all components ?

Ah, probably because hst restricts the scope of each variable into a separate namespace per component. You probably need to use the following:

 request.getRequestContext().getServletRequest().setAttribute("name", "value");

Note that the “name” variable should be globally unique so it doesn’t clash with anything else of course.