Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/community/write-a-blog-post/contents.lr
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Once you have written your post, you can either send it to us (Markdown is easie
---
pub_date: Replace this text with the publication date in YYYY-MM-DD format.
---
excerpt: Replace this text with a summary of your blog post. This is an optional field. If left blank, the first 100 characters of your blog post will be used.
---
body:
Replace this text with your post's content (minus the title). This field accepts Markdown for formatting.
If you're including images, you can use the Markdown image syntax i.e. ![image-title](image-file-name.jpg).
Expand Down
5 changes: 5 additions & 0 deletions models/blog-post.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ type = strings
[fields.body]
label = Body
type = markdown

[fields.excerpt]
label = Excerpt
type = markdown
width = 1/2
6 changes: 5 additions & 1 deletion themes/vocabulary_theme/templates/macros/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
<h4 class="b-header"><a class="blog-title" href="{{ post|url }}">{{ post.title }}</a></h4>
{{ render_authors_byline(post) }}
<div class="excerpt">
{{ post.body | excerpt | string | striptags() | truncate(100) }}
{% if post.excerpt %}
{{ post.excerpt }}
{% else %}
{{ post.body | excerpt | string | striptags() | truncate(100) }}
{% endif %}
</div>
</div>
</article>
Expand Down
Loading