hyperlinking the Dublin Core subject fields

I would like to hyperlink my Dublin Core subject fields (much like the tags) so that when a user goes to click on a subject link, it will take them to all the items with that subject field. Is this possible?


There is nothing out-of-the-box that will allow you to do this, but there are a couple of options.

1. Create custom links for your subject headers that are search results pages for that specific subject. To get that link, go to the Advanced Search and search in the subject field for "yoursubject" and then copy that URL and link to it.

2. Or, if you have some moderate programming skills, you could write a function that acts similarly to the way that Omeka creates and shows tags.

breezilla - let us know how you go. I'd love this functionality too.

The following code implements the first suggested method. It displays all the subjects associated with an item displayed in the browse listing. When the subject link is clicked, it generates a browse listing filtered by that subject.

<?php if( $subjects = metadata('item', array('Dublin Core', 'Subject'), array('all' => true))): ?>
<div class="item-subjects-list">
foreach ($subjects as $subject) {
$subject_links[] = '<span class="item-subject">' . "$subject ".'</span>';
echo join(' / ', $subject_links);


place code in views/scripts/items/browse.php below description (or where you want it to go)

I'm sure there are improvements that could be made, such as calling link_to_items_browse() instead of building the query string piecemeal.


This is also now doable with the Search By Metadata plugin.

Thanks. I'll take a look!

I successfully installed the Search By Metadata plugin. It seems to work as documented for an item page in the admin section of the site.

Edit: I looked in the admin theme for item/show.php and checked. It is using echo all_element_texts('item') to generate the listing of elements. Next, I uncommented this function call on the public show.php and discovered that the Subject elements are all displayed and linked. The problem appears to be something that all_elements_texts() does that my looping does not.

For example:

Pioneer Axe

Arts & Crafts, Traditional



all are linked to search/browse

On the public item page, only the first subject displays (it is linked to the search for the metadata subject term). It appears that in the public item page the subjects are not automatically iterated over.

What I want to do is get this plugin working as advertised, displaying all the DC Subject terms associated with an Item on the Public Item Page as subject terms linked to the advanced search.

I also want to modify this plugin to provide the same feature for each item in the Advanced Item Search results listing, replacing the ad hoc method I use now.

Can you point me in the right direction?



If you want to see the plugin in action, we used it on the Mall Histories site, with no modification needed for the public item/show page.

Custom browse pages are created for multiple entries for two different DC metadata fields (creator and coverage): http://mallhistory.org/items/show/59

I can't walk you through your customizations, but this is the plugin doing its thing.

A possibility, depending on how your theme is presenting fields, is that your two subjects, Arts & Crafts, Traditional, are actually entered as just one subject in the interface. That is, if they are entered in one field separated by commas, rather than using the Add Input button, then the filter only runs on the one input that's used.

I thought there was a problem with the plugin. When I looped through the array and created my own links, I did not see duplicated links as I expected after activating the plugin. I did not realize nested anchors were being displayed and functioning normally (or at least it appeared as if the links were normal until I viewed the source).

I suspected the filter was being applied to each Subject text in the array before output by metadata(), so dumped the array. The subjects are already linked. I thought they would be filtered after output when looping through the array. I see that I do not have to loop through the subjects, which is the advantage of filtering them before output by metadata().

So I am good.

Sorry, I meant to say that I do not have to loop through the subjects to filter them. I do use a loop to output them:

// Subjects texts are pre-linked to search by the Search by Metadata plugin.
	$subjects = metadata('item', array('Dublin Core', 'Subject'), array('all' => true));
    foreach ($subjects as $subject) {
    	echo $subject;
    	echo '<br>';