How to create dynamic URLs using ex:*-subcontent

From SIMILE Widgets
Jump to: navigation, search

Dynamic URLs with ex:*-subcontent

In order to create dynamic URLs in exhibit by referencing property values from a JSON file (to make a "google this term" link, for example), we can use the ex:*-subcontent attribute, instead of the usual ex:*-content. For example, here is a normal link using the ex:href-content attribute with a property called wikipediaURL:

<a ex:if-exists=".wikipediaURL" ex:href-content=".wikipediaURL" >wikipedia link</a>

and here are some examples of dynamic links using ex:href-subcontent by referencing the label property with the {{ }} syntax:

<a ex:href-subcontent="http://www.google.com/search/?q={{.label}}" >google search</a>
<a ex:href-subcontent="http://www.flickr.com/search/?q={{.label}}" >flickr image search</a>
<a ex:href-subcontent="http://images.google.com/images?q={{.label}}" target="_blank" >google image search</a>
<a ex:href-subcontent="http://www.youtube.com/results?search_query={{.label}}" >youtube video search</a>
<a ex:href-subcontent="http://video.google.com/videosearch?q={{.label}}" >google video search</a>
<a ex:href-subcontent="http://del.icio.us/search/?fr=del_icio_us&p={{.label}}&type=all" >del.icio.us tag search</a>

ex:*-subcontent also supports the use of multiple property values:

<a ex:href-subcontent="http://maps.google.com/maps?f=q&hl=en&q={{.city}},{{.country}}" target="_blank" >map</a>

Feel free to add other techniques or tips...

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox