Enclosing link inside if statement fails

Hello! I have a Jekyll site and I’m trying to generate a list of courses based on a yaml file. I have incorporated if statements so I can print entries for some courses but not others, depending on whether a certain attribute exists in the yaml entry.

The yaml file is here and the page is here. You can see the Jekyll code for the page here.

Somehow, enclosing an element inside an if block, like so:

{% if entry.syllabus %}
    [Syllabus](/assets/pdf/{{entry.syllabus}})
  {% endif %}

makes Jekyll format the result as a code snippet rather than implementing the link. The same text, if placed outside the if block, works as intended and produces a link.

What am I doing wrong?

maybe cause you have the link indented? try removing the spaces. Indentation is one way to create a code block I think.

1 Like

No idea, but what if you used html instad? Like <a href="/assets/pdf/{{entry.syllabus}})">Syllabus</a>?

1 Like

that would probably have fixed it too!