Answers.Body: <p>There is no way at present to delegate a field as the search excerpt field in Craft, so it needs to be handled by the search results template. It is possible to use conditionals but this can bloat the template, especially when there are multiple sections and each section outputs different fields in different ways, so I prefer to create dedicated search excerpt templates and include them in the search results template as follows:</p>
  
  <pre><code>{% include ['_search-excerpts/' ~ entry.section.handle, '_search-excerpts/default'] %}
  </code></pre>
  
  <p>The above code will render the section's dedicated search excerpt template if it exists in a folder called <em>_search-excerpts</em>, otherwise it will render the default search excerpt template which can contain for example:</p>
  
  <pre><code>&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;
  </code></pre>
  
  <p>The resulting folder structure would then look like this:</p>
  
  <pre><code>_search-excerpts/default.html
  _search-excerpts/sectionA.html
  _search-excerpts/sectionB.html
  _search-excerpts/sectionC.html
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-13T09:36:18.987Z
Answers.LastActivityDate: 2014-06-26T17:50:01.450Z
Answers.LastEditDate: 2014-06-26T17:50:01.450Z
Answers.UserDisplayName: Ben Croker
Answers.Body: <p>This can be accomplished using a conditional:</p>
  
  <pre><code>{% if entry.section == 'sectionA' %}
      {{ entry.sectionAField }}
  {% elseif entry.section == 'sectionB' %}
      {{ entry.sectionBField }}
  {% endif %}
  </code></pre>
  
  <p>or a switch statement:</p>
  
  <pre><code>{% switch entry.section %}
      {% case "sectionA" %}
         {{ entry.sectionAField }}
      {% case "sectionB" %}
         {{ entry.sectionBField }}
  {% endswitch %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-13T22:59:08.110Z
Answers.Text: Worth noting that one of the big advantages of being able to share field across sections is that a lot of the time the excerpt field will be the same so no need for the if's but when it's not you got the right idea
Answers.UserDisplayName: Keith Mancuso
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-12T17:02:14.123Z
Answers.LastActivityDate: 2014-07-17T22:11:25.503Z
Answers.LastEditDate: 2014-07-17T22:11:25.503Z
Answers.UserDisplayName: Anna_MediaGirl
Body: <p>How do I create search result page "excerpts" when there are multiple sections/fields that need to be represented?</p>
  
Tags: <search>
Title: How can I display search "excerpts" from multiple sections?
ThreadText: # How can I display search "excerpts" from multiple sections?
  
  (Asked by: username_0 on 2014-06-12)
  
  How do I create search result page "excerpts" when there are multiple sections/fields that need to be represented?
  
  **Tags:** search
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2014-06-12. Score: 9 | Accepted answer
  
  This can be accomplished using a conditional:
  
  ```
  {% if entry.section == 'sectionA' %}
      {{ entry.sectionAField }}
  {% elseif entry.section == 'sectionB' %}
      {{ entry.sectionBField }}
  {% endif %}
  
  ```
  
  or a switch statement:
  
  ```
  {% switch entry.section %}
      {% case "sectionA" %}
         {{ entry.sectionAField }}
      {% case "sectionB" %}
         {{ entry.sectionBField }}
  {% endswitch %}
  
  ```
  
  > **Comments:**
  > **username_2**: Worth noting that one of the big advantages of being able to share field across sections is that a lot of the time the excerpt field will be the same so no need for the if's but when it's not you got the right idea  
  
  ---
  
  ### Answer by username_1 on 2014-06-13. Score: 11
  
  There is no way at present to delegate a field as the search excerpt field in Craft, so it needs to be handled by the search results template. It is possible to use conditionals but this can bloat the template, especially when there are multiple sections and each section outputs different fields in different ways, so I prefer to create dedicated search excerpt templates and include them in the search results template as follows:
  
  ```
  {% include ['_search-excerpts/' ~ entry.section.handle, '_search-excerpts/default'] %}
  
  ```
  
  The above code will render the section's dedicated search excerpt template if it exists in a folder called *\_search-excerpts*, otherwise it will render the default search excerpt template which can contain for example:
  
  ```
  <a href="{{ entry.url }}">{{ entry.title }}</a>
  
  ```
  
  The resulting folder structure would then look like this:
  
  ```
  _search-excerpts/default.html
  _search-excerpts/sectionA.html
  _search-excerpts/sectionB.html
  _search-excerpts/sectionC.html
  
  ```
  
  
  ---
  
  