Add note in Posts docs about stripping <p> tags from excerpt.
Fixes #1926. Merges #1933.
This commit is contained in:
		
							parent
							
								
									8bc51fdb5c
								
							
						
					
					
						commit
						b053a1edf1
					
				| 
						 | 
					@ -138,12 +138,19 @@ posts:
 | 
				
			||||||
  {% raw %}{% for post in site.posts %}{% endraw %}
 | 
					  {% raw %}{% for post in site.posts %}{% endraw %}
 | 
				
			||||||
    <li>
 | 
					    <li>
 | 
				
			||||||
      <a href="{% raw %}{{ post.url }}{% endraw %}">{% raw %}{{ post.title }}{% endraw %}</a>
 | 
					      <a href="{% raw %}{{ post.url }}{% endraw %}">{% raw %}{{ post.title }}{% endraw %}</a>
 | 
				
			||||||
      <p>{% raw %}{{ post.excerpt }}{% endraw %}</p>
 | 
					      {% raw %}{{ post.excerpt }}{% endraw %}
 | 
				
			||||||
    </li>
 | 
					    </li>
 | 
				
			||||||
  {% raw %}{% endfor %}{% endraw %}
 | 
					  {% raw %}{% endfor %}{% endraw %}
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
{% endhighlight %}
 | 
					{% endhighlight %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Because Jekyll grabs the first paragraph you will not need to wrap the excerpt in `p` tags,
 | 
				
			||||||
 | 
					which is already done for you. These tags can be removed with the following if you'd prefer:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% highlight html %}
 | 
				
			||||||
 | 
					{% raw %}{{ post.excerpt | remove: '<p>' | remove: '</p>' }}{% endraw %}
 | 
				
			||||||
 | 
					{% endhighlight %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If you don't like the automatically-generated post excerpt, it can be overridden by adding
 | 
					If you don't like the automatically-generated post excerpt, it can be overridden by adding
 | 
				
			||||||
`excerpt` to your post's YAML front-matter. Completely disable it by setting
 | 
					`excerpt` to your post's YAML front-matter. Completely disable it by setting
 | 
				
			||||||
your `excerpt_separator` to `""`.
 | 
					your `excerpt_separator` to `""`.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue