Display Tags on Content - Documentation topics on: displaying tags on content,dotcontent tool,tagging content,tags,velocity pull,.

Display Tags on Content

The following example shows how to reference content type's Tags field using a Velocity content pull. The tags are displayed both as a string, and individually (by iterating in Velocity over the contents of the Tags field).

#foreach($con in $dotcontent.pull("+contentType:News",10,"modDate desc"))
    ##A tag field contains a List of Strings/Tags
    <strong>Tags</strong> : $con.tags<br/>
    #foreach($tag in $con.tags)
        $tag #if( $foreach.hasNext ), #end

Note that the #if( $foreach.hasNext ), #end code will add a comma after each tag displayed except the last one, providing a proper comma separated list.