jsl303
April 25, 2020, 4:11pm
1
I have md looping through a collection like this:
{% for item in site.items %}
[{{ item.title }}]({{ item.url }})
{% endfor %}
However, I get:
<p><a>text</a></p>
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!
rdyar
April 25, 2020, 5:12pm
2
I don’t think so, I think this is the same as this issue?
opened 09:45PM - 06 Mar 16 UTC
Is there a way to configure the parser in such a way as NOT to generate the surrounding paragraph tags?
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 -%}
etc.
1 Like
jsl303
April 27, 2020, 6:04am
4
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.