Editing Search Results page for Foundation?

Hello:

Does anyone know which file should be edited in order to edit the search results page in the Foundation theme?

I don’t seem to be having any luck with the pages in the view/omeka/search folder, so I am wondering if I might be barking up the wrong tree.

And it’s the search results within a single site that you’re trying to edit, not the “top level” global search, right?

@jflatnes, Yes, the one within a single site.

I noticed that in Foundation, the search results first appear as a short list followed by a ‘View all results’ link. Ideally I’d like to set up the search to skip this intermediary first page and have the user taken to ‘View all results’ page from the start. Any ideas on how to do that?

If this is not possible, then I would like to edit the first page to show thumbnails of the items found.

As for that intermediary page, you can change this behaviour in the search settings under “site settings” for each of your sites.

In the search settings there, if you enable only “items” and disable “site pages” and “item sets” then you won’t have that intermediary page.

The short list followed by “View all results” is a somewhat recent default behavior across the themes. It exists as an intermediary because it can search items, item sets, and pages; the “view all results” goes to a results page filtered to the respective resource type. If you don’t think your user will need search for anything but items, you can use the solution @giocomai suggested.

In the future, we’ll provide thumbnails by default in the site wide search results view. In the meantime, you can create a custom view within Foundation to do it yourself with the following changes:

  1. Within your Foundation S directory, create the directory path view/index/.
  2. Within your Omeka S directory, copy the file application/view/index/search.phtml into the directory you created in step 1.
  3. In view/index/search.phtml, line 35 should read something like
        <li>
           <?php echo $resource->link($resource->$titleMethod()); ?>
        </li>

Replace it with the following.

        <?php $hasThumbnail = $resource->primaryMedia(); ?>
        <li>
            <?php if ($hasThumbnail): ?>
                <?php echo $resource->linkPretty(); ?>
            <?php else: ?>
                <?php echo $resource->link($resource->$titleMethod()); ?>
            <?php endif; ?>
        </li>

After that, you should have images where applicable. If you’d like some starter styles to work off of, download the CSS Editor and configure it with these styles:

.resource-link {
  display: flex;
  align-items: center;
}

.search.index .resource-link img {
  height: 4em;
  margin: 0 .5rem 0 0;
}
2 Likes

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.