As part of a client’s header navigation improvement, it was decided to
utilise SDL Web’s Taxonomy to render a three level tree structure to
represent the client’s navigation header. The same taxonomy hierarchy
can also be used to render the footer navigation.
It was decided that the taxonomy hierarchy were to be generated via
TBB and published as a JSON file to the content broker. This can then
be retrieved via DD4T’s PageFactory.FindPageContent(url) in the web
app, cached and then parsed to the relevant model.
There was a client requirement for accessing images in the content
manager via a third party service called Media Bin. This was achieved
using ECL (External Content Library) API and the content editors were
happy. The keyword metadata used for taxonomy included ECL items.
The following is how these values were retrieved.
The TBB will involve recursively iterating two taxonomy hierarchies,
retrieve each keyword’s metadata content and populate a model
representing each field.
One field was an ECL Item representing the logo of the header. The
logo’s model was represented as such:
The url , srcSetA and srcSetB were fully qualified url ready to be
rendered in the view. I created a helper class called EclHelper:
I would have preferred if the helper wasn’t instantiated as such and
instead did something along the line of:
I hope that this helps anyone else who encounters something similar.
If you liked this article, you may find these resources interesting also:
- SDL WEB 8.5 DEVELOPER BOOTCAMP
- TRY OUR SDL WEB 8 TOPOLOGY GENERATOR
- JOIN THE SDL WEB COMMUNITY SLACK