Avoiding P Tag?

I have md looping through a collection like this:

{% for item in site.items %}
[{{ item.title }}]({{ item.url }})
{% endfor %}

However, I get:


Is there a way to get rid of p tag?

I tried the following without a success.

[{{ item.title | remove: '<p>' | remove: '</p>' }}]({{ item.url }})

Thanks for your help!

I don’t think so, I think this is the same as this issue?

Can you do just that portion in html instead of markdown?

Liquid inserts blank lines around
{% Whatever %}
unless you write
{%- Whatever -%}
Found this here

So for you
{%- for item in site.items -%}

1 Like

Thanks for the tip!
Also I found out that if you put {% endfor %} on the same line as
the last line of loop, it works for some reason.

{% for item in site.items %}
    [{{ item.title }}]({{ item.url }}){% endfor %}

This is a really important piece of information. I needed it too, because when I tried to style my navigation, there always was this blank space in between the links.

In my opinion, this should be explained in the Step-by-step guide, because it is quite important for most users.