Skip to content

Commit

Permalink
Support comment-based excerpts
Browse files Browse the repository at this point in the history
See #35 and #49
  • Loading branch information
piperhaywood committed Nov 1, 2019
1 parent bbc2eff commit f7c5e3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ module.exports = eleventyConfig => {
});
});

// Add excerpts
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: "<!-- more -->"
});

// Minify CSS
eleventyConfig.addFilter("cssmin", code => {
return new CleanCSS({}).minify(code).styles;
Expand Down
4 changes: 2 additions & 2 deletions src/_includes/components/single-post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
{%- endset -%}
{%- set singleTags = post.data.tags -%}
{%- set singleContent -%}
{% if post.data.excerpt %}
{{ post.data.excerpt | markdownify | safe }}
{% if post.data.page.excerpt %}
{{ post.data.page.excerpt | markdownify | safe }}
<a class="button button--more" href="{{ post.url | url }}">Read more</a>
{% else %}
{# TODO For some reason this isn’t working when filtered by tag #}
Expand Down

0 comments on commit f7c5e3a

Please sign in to comment.