Answers.Body: <p>In case anyone is wondering how you get the rest of the text – here is an example:</p>
  
  <pre><code>{# Split paragraphs using a limit of 2 #}
  {% set paragraphs = block.body|split('&lt;/p&gt;', 2) %}
  
  {# Get first paragraph and add the missing closing tag  #}
  {% set firstParagraph = paragraphs|first ~ '&lt;/p&gt;' %}
  
  {{ firstParagraph|raw }}
  
  {# The rest of the text is here, due to the limit in the split filter #}
  {{ paragraphs|last|raw }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-19T17:04:26.377Z
Answers.LastActivityDate: 2016-02-19T17:04:26.377Z
Answers.UserDisplayName: medoingthings
Answers.Body: <p>Just for reference, if you use a regular Rich Text field for an optional custom Post Excerpt and a Matrix field (with a "text" field in it, among others) for the Post Body, you could check the custom excerpt for content and otherwise output the first paragraph of the text field in the first Matrix block of type textBlock: </p>
  
  <pre><code>{% for entry in craft.entries.section('blog').find() %}
  
          &lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
  
          &lt;div class="post-summary"&gt;
              {% if entry.postExcerpt | length %}
                  {# Custom Excerpt #}
                  {{ entry.postExcerpt }}
              {% elseif entry.postBody.type('textBlock').first() | length %}
                  {# Auto Excerpt: in postBody Matrix, find first text block and extract first paragraph #}
                  {% set first_block = entry.postBody.type('textBlock').first() %}
                  {% set first_block_text = first_block.text %}
                  {% set paragraphs = first_block_text|split('&lt;/p&gt;') %}
                  {% set first_paragraph = paragraphs|first ~ '&lt;/p&gt;' %}
                  {{ first_paragraph | raw }}
              {% endif %}
          &lt;/div&gt;
          &lt;p&gt;&lt;a href="{{ entry.url }}"&gt;Read More&lt;/a&gt;&lt;/p&gt; 
  
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T19:29:10.503Z
Answers.LastActivityDate: 2014-07-03T19:29:10.503Z
Answers.UserDisplayName: James Muspratt
Answers.Body: <p>You can do this entirely with Twig.</p>
  
  <p>First, use the <a href="http://twig.sensiolabs.org/doc/filters/split.html"><code>|split</code> filter</a> to split your HTML into an array of paragraphs, on their closing <code>&lt;/p&gt;</code> tags:</p>
  
  <pre><code>{% set paragraphs = entry.myRichTextField|split('&lt;/p&gt;') %}
  </code></pre>
  
  <p>Then, you can assign the first paragraph to a new variable using the <a href="http://twig.sensiolabs.org/doc/filters/first.html"><code>|first</code> filter</a>. And don’t forget to bring back that missing <code>&lt;/p&gt;</code>.</p>
  
  <pre><code>{% set firstParagraph = paragraphs|first ~ '&lt;/p&gt;' %}
  </code></pre>
  
  <p>Finally, you can output that. Use the <a href="http://twig.sensiolabs.org/doc/filters/raw.html"><code>|raw</code> filter</a> so that Twig doesn’t encode the HTML entities.</p>
  
  <pre><code>{{ firstParagraph|raw }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-09T19:05:45.440Z
Answers.Text: `{{ entry.body|split('</p>')|first|raw }}` seems to be working too
Answers.UserDisplayName: 321zeno
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-02T16:29:53.213Z
Answers.Text: This outputs a strings like this:
  
  "<p>This is outputted text</p>"
  
  Is there an easy way to get rid of those <p> tags in that string or to make them actually format the text?
Answers.UserDisplayName: Allen Pieper
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-02T16:32:14.400Z
Answers.Text: @AllenPieper Sorry about that, forgot to include the `|raw` filter. Updated my answer.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-02T16:16:53.900Z
Answers.LastActivityDate: 2014-07-02T16:31:48.770Z
Answers.LastEditDate: 2014-07-02T16:31:48.770Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I have a rich text output section I want to limit to the first paragraph so I can link to a full version on another page. What's the best way to do this?</p>
  
Tags: <richtext>
Title: Is there a way to output only the first paragraph of a Rich Text field?
ThreadText: # Is there a way to output only the first paragraph of a Rich Text field?
  
  (Asked by: username_0 on 2014-07-02)
  
  I have a rich text output section I want to limit to the first paragraph so I can link to a full version on another page. What's the best way to do this?
  
  **Tags:** richtext
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2014-07-02. Score: 30 | Accepted answer
  
  You can do this entirely with Twig.
  
  First, use the [`|split` filter](http://twig.sensiolabs.org/doc/filters/split.html) to split your HTML into an array of paragraphs, on their closing `</p>` tags:
  
  ```
  {% set paragraphs = entry.myRichTextField|split('</p>') %}
  
  ```
  
  Then, you can assign the first paragraph to a new variable using the [`|first` filter](http://twig.sensiolabs.org/doc/filters/first.html). And don’t forget to bring back that missing `</p>`.
  
  ```
  {% set firstParagraph = paragraphs|first ~ '</p>' %}
  
  ```
  
  Finally, you can output that. Use the [`|raw` filter](http://twig.sensiolabs.org/doc/filters/raw.html) so that Twig doesn’t encode the HTML entities.
  
  ```
  {{ firstParagraph|raw }}
  
  ```
  
  > **Comments:**
  > **username_0**: This outputs a strings like this:  "<p>This is outputted text</p>"  Is there an easy way to get rid of those <p> tags in that string or to make them actually format the text?  
  > **username_3**: @username_0 Sorry about that, forgot to include the `|raw` filter. Updated my answer.  
  > **username_4**: `{{ entry.body|split('</p>')|first|raw }}` seems to be working too  
  
  ---
  
  ### Answer by username_1 on 2016-02-19. Score: 8
  
  In case anyone is wondering how you get the rest of the text – here is an example:
  
  ```
  {# Split paragraphs using a limit of 2 #}
  {% set paragraphs = block.body|split('</p>', 2) %}
  
  {# Get first paragraph and add the missing closing tag  #}
  {% set firstParagraph = paragraphs|first ~ '</p>' %}
  
  {{ firstParagraph|raw }}
  
  {# The rest of the text is here, due to the limit in the split filter #}
  {{ paragraphs|last|raw }}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2014-07-03. Score: 5
  
  Just for reference, if you use a regular Rich Text field for an optional custom Post Excerpt and a Matrix field (with a "text" field in it, among others) for the Post Body, you could check the custom excerpt for content and otherwise output the first paragraph of the text field in the first Matrix block of type textBlock:
  
  ```
  {% for entry in craft.entries.section('blog').find() %}
  
          <h2>{{ entry.title }}</h2>
  
          <div class="post-summary">
              {% if entry.postExcerpt | length %}
                  {# Custom Excerpt #}
                  {{ entry.postExcerpt }}
              {% elseif entry.postBody.type('textBlock').first() | length %}
                  {# Auto Excerpt: in postBody Matrix, find first text block and extract first paragraph #}
                  {% set first_block = entry.postBody.type('textBlock').first() %}
                  {% set first_block_text = first_block.text %}
                  {% set paragraphs = first_block_text|split('</p>') %}
                  {% set first_paragraph = paragraphs|first ~ '</p>' %}
                  {{ first_paragraph | raw }}
              {% endif %}
          </div>
          <p><a href="{{ entry.url }}">Read More</a></p> 
  
  {% endfor %}
  
  ```
  
  
  ---
  
  