gpt4 book ai didi

jekyll - 在 Jekyll 帖子列表中添加广告

转载 作者:行者123 更新时间:2023-12-04 05:18:40 25 4
gpt4 key购买 nike

我正在寻找一种方法来做这样的事情:

<ul>
<li class="post"></li>
<li class="ad"></li>
<li class="post"></li>
<li class="post"></li>
<li class="post"></li>
</ul>

生成帖子列表对我来说不是问题,它正在注入(inject) li.ad进入该帖子列表。

目前,我已经获得了返回所有帖子的基本 for 循环:
{% for post in site.posts %}
<li class="post">
<h1><a href="{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h1>
<p>{{ post.summary }}</p>
</li>
{% endfor %}

最佳答案

结果证明效果很好-非常感谢Dave Rupert寻求他的帮助。

{% for post in site.posts %}

<li class="post">
<!-- post stuff -->
</li>

{% if forloop.first %}

<li class="ad">
<!-- ad stuff -->
</li>

{% endif %}

{% endfor %}

关于jekyll - 在 Jekyll 帖子列表中添加广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13932879/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com