I’m trying to create a list of tags based from a Metadata Select Field. As per the Useful Keyword Replacement instructions, I’m able to split the comma separated string and wrap it in a HTML.
However, I’m unable to apply create links with each tag value.
This is what used to separate the string with anchor tag: %asset_metadata_tagList^replace:;:</a><a>^tagif:a%
here I tried to add the link value but it just prints the entire comma separated string inside the href: %asset_metadata_tagList^replace:;:</a><a href="./search?{asset_metadata_tagList}">^tagif:a%
I just can’t get my head around it, tried various combinations.
So if I understand you correctly you want a list of tags tag 1, tag 2 etc and have them as hyperlinks. So if I clicked on tag 2 that filter all asset tagged with tag 2?
Have you tried the following: yourdomain.com.au/your-asset?tagcategory=Metadata_key
The filter part is all sorted.
I just want to print the individual comma separated values (Apple; Orange; Banana;) from the Metadata Select Field into the href.
If you have access to a Matrix version that has server side JS then you might be best to use this to split the tags into an array and iterate over them.
Not sure if there is a simple way using keywords to do what you are wanting.
Other option might be to use xslt keyword - but server side js would be simpler.
One last thing - how about an asset listing page and use Group Format? <option value="./search?%asset_metadata_tagList%">%group_name%</option>
Then in your Asset Grouping metadata field select the metadata schema (tagList)? That way your dropdown/select would be dynamically generated. I’m not 100% sure what what you’re trying to do but this may be an option worth investigating
Asset listing might be a possible solution but the page is already asset listing 3 different asset types and creating a nested asset listing to display the tags may hit on performance. In addition, it is going to be used as tag therefore we don’t really want create select option or have to create hacky CSS to display it like a tag.
Here is an image of working example, for now I have opted for 3 line of jQuery to create the links dynamically.