How to create dynamic URLs using ex:*-subcontent

From SIMILE Widgets
Revision as of 15:31, 27 August 2009 by Johncallahan (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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="{{.label}}" >google search</a>
<a ex:href-subcontent="{{.label}}" >flickr image search</a>
<a ex:href-subcontent="{{.label}}" target="_blank" >google image search</a>
<a ex:href-subcontent="{{.label}}" >youtube video search</a>
<a ex:href-subcontent="{{.label}}" >google video search</a>
<a ex:href-subcontent="{{.label}}&type=all" > tag search</a>

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

<a ex:href-subcontent="{{.city}},{{.country}}" target="_blank" >map</a>

Feel free to add other techniques or tips...

Personal tools