Direct Linking to Collection Pages Instead of Collection Previews in Thanks, Roy Theme

Hello Omeka Community,

I’m using the default Thanks, Roy theme and need assistance modifying the collections browsing functionality on my site. Currently, when users click on a collection, they are taken to a preview page. This page includes a “View All Items” link and the collection’s description. However, I would like to change this behavior so that clicking on a collection link takes users directly to the collection page itself, bypassing the preview.

Additionally, I noticed that the collection’s description appears on the preview page but not on the actual collection page. I would like to ensure that the collection’s description is also displayed on the collection page.

Has anyone implemented this functionality or can provide guidance on how to achieve it?

Thank you for your help!

The trouble here is that the “preview” page really is the collection page, that’s how collections are shown in Omeka Classic, so that’s where the metadata and so on is shown.

View All Items takes you to an item browse page that’s limited to only show items in the collection. It’s the regular item browse page used for all item browsing, so it doesn’t show information about the collection you’re looking at.

It’s possible to change the theme’s view used for the browse page to show collection information when browsing a collection’s items (you could check for the browse parameter used to set which collection is being browsed, look up the collection object, and display its metadata). You could also modify the collections browse page to change which links it generates, to go right to the item-browse rather than the collection show or “preview.”

Just changing the links, you’d be looking at editing the collections/browse.php file in your theme (if your theme doesn’t have that file, first copy it from application/views/scripts/collections/browse.php in the core).

The usual line for linking to the collection is

    <h2><?php echo link_to_collection(); ?></h2>

and the usual one to browse the items is

    <?php echo link_to_items_browse(__('View the items in %s', metadata('collection', 'rich_title', array('no_escape' => true))), array('collection' => metadata('collection', 'id')), array('class' => 'view-items-link')); ?>

So, you can replace the first one with a slight modification of the second to change the link text:

    <h2><?php echo link_to_items_browse(metadata('collection', 'rich_title', array('no_escape' => true)), array('collection' => metadata('collection', 'id'))); ?></h2>

And you could just remove the now-redundant “View the items in” link.

Probably you’d also want to replace the line used to make the image into a link, from:

<?php echo link_to_collection($collectionImage, array('class' => 'image')); ?>


<?php echo link_to_items_browse($collectionImage, array('collection' => metadata('collection', 'id')), array('class' => 'image')); ?>

Changing what’s shown on the browse page is a little more involved and probably needs some styling, too.

Thank you for the detailed explanation.

I couldn’t get it to work. How about the links from the Collection Tree, they direct users to the collection preview page. Is there another file or a specific function that I need to modify to ensure that clicking a collection link from the Collection Tree takes users directly to the collection’s items page?