Exercise 9.2: Set up Job posting content type display in global search
Try to conduct a search for a published Job posting content type. You’ll notice that it appears differently to other content types:
This is because the search index isn’t configured to display the right View mode for the Job posting content type and it shows the same content as the full-page view.
Let’s change that, by activating Search view mode in the Job Posting content type and then configuring the search to use it.
Go to Structure → Content types → Job Posting → Manage display.
Under the Custom display settings, enable the Search view mode. Save the changes.
Click the Search link at the top (in the secondary tabs) to navigate to the Search view mode.
Under the Select a layout field, select Search and save the changes. You’ll notice that the fields table below now shows multiple regions, such as:
Title
Info
Summary
Tags
Disabled
Rearrange fields (drag-and-drop) to match the screenshot. Move the remaining fields into the disabled region. Focus on making the Title field a link and trimming the Job description down to 300 characters. Remember to Save your changes.
Now, as we created and customised the Job posting view mode for Search, let’s make the search page to use it. Our search page is made as a View, although it’s set to use the Search API functionality. We’ll explore how to create a Search API view later.
Go to Structure → Views and edit the Search view.
Under Format → Show, click on the Settings link:
Locate the “View mode for datasource Content, bundle Job Posting” and change it to use the Search view mode created earlier
Apply your changes and Save the view.
Repeat search for a job posting and confirm if the display looks similar to other content types.
You may return to the Search view mode in the Job posting content type and change it further, to test how your changes affect the search results display widget.
Last updated