Custom Modules Search - only heading is showing - cant view content


On this test website

Please could someone tell me how I can get the content (text) of a Custom Module to show up in a search - at the moment only the heading shows on the search results page.

eg if i search for Emma Nash - the results come up just as her name and no link through to content

I have Custom Modules for Services
and Our Team -

Hi @Dawn. It’s most likely in your search listing layout, which is found under ‘Content’ > ‘Pages’ > ‘Edit Settings’ > ‘Layouts’.

This layout likely has {{this['description']}} already in it, but I’m guessing your Custom Modules are using a custom field for the main text?
If that’s the case you may need to do some Liquid conditions to display the text in those cases.

This is the code I am using below - but I dont know how to write liquid conditions - I am araid that level of coding is beyond me, please could you advise/help

image description
<div id="{{this['ModalID']}}" class="modal modal-detail">
    <div class="modal-content">
        <a class="close modal-close" href="javascript:;"><i class="material-icons">close</i></a>
        <div class="module-wrap ">
        <div class="row">
            <div class="col s12 m5 top-wrap">
                <div class="img-block">
                     <img src="{{this['ImageSize400pxWidth500pxHeight']}}" alt="image description">
            <div class="col s12 m7">
                <div class="heading">
                  <h3 class="">{{this['Name']}}</h3>
                 <ul class="contact-list">
            {% if this['Email'].size > 0 -%}
            <li><a target="_blank" class="icon icon-envelope" href="mailto:{{this['Email']}}"></a></li>
            {% endif -%}
            <div class="team-memb-description content-modal">

Sure. Could you post the code that’s in your search layout?

‘Content’ > ‘Pages’ > ‘Edit Settings’ > ‘Layouts’:

If you find your search layout, replace {{this['Description']}} with:

{% if this['DescriptionTeam'] != null %}{{this['DescriptionTeam']}}{% else %}{{this['Description']}}{% endif %}

Basically this says, if your Team Description field is present show it, otherwise show the default Description field.

Hope that helps.

Hi Adam
I have replaced the code with this below - but it is still not working.
{% for item in this.items %}

{{this.pagination.currentpage | minus: 1 | times : this.pagination.itemsperpage | plus : forloop.index}}. {{item[‘Name’]}}

{% if this[‘DescriptionTeam’] != null %}{{this[‘DescriptionTeam’] | strip_html | truncatewords: 70}}{% else %}{{this[‘Description’] | strip_html | truncatewords: 70}}{% endif %}


{% endfor %}

Hmm, should work.
Can you take a screenshot of the search layout code please - just so I can see it more accurately.

Ah, sorry. In that layout, change that bit of code’s this references to item, like so:

{% if item['DescriptionTeam'] != null %}{{item['DescriptionTeam'] | strip_html | truncatewords: 70}}{% else %}{{item['Description'] | strip_html | truncatewords: 70}}{% endif %}
1 Like

you SUPERSTAR - it worked thank you so much