Quy Nguyen
Quy Nguyen

Reputation: 124

How to fix empty ouput of custom excerpt in Blog page?

I am using a custom excerpt in my blog post, but I got an empty output if the length of excerpt is too long.

If I reduce some words in excerpt, then it worked. Do you have any ideas how to fix it?

Thank you

My post configuration:

--- 
title: Test a Perceptual Phenomenon
layout: notebook

excerpt: In a Stroop task, participants are presented with a list of words, with each word displayed in a color of ink. The participant’s task is to say out loud the color of the ink in which the word is printed.

---

My blog page:

---
layout: default
title: Blog

---
<h1>Latest Posts</h1>

<ul>
  {% for post in site.posts %}
    <li>
      <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
      <p>{{ post.excerpt }}</p>
      <p>{{ post.post_description }}</p>
    </li>
  {% endfor %}
</ul>

Upvotes: 0

Views: 36

Answers (1)

David Jacquel
David Jacquel

Reputation: 52799

Ok. I managed to reproduce your problem using this file. And it was because of a colon used in your front matter post_description.

eg : post_description: In a Stroop task, ... The task has two conditions: a congruent ...

To fix this, you can use quotes or double quotes.

post_description: 'Your text with escaped \'quotes\' and "double quotes" : success'
post_description: "Your text with 'quotes' and \"escaped double quotes\" : success'

Or you can use multi line string

post_description : >
  A long text with special characters : success !
  Another line.

Upvotes: 1

Related Questions