问:如何在anqicms栏目页的文章列表的开始和结束位置添加广告位?
答:在anqicms栏目页的文章列表的开始和结束位置添加广告位,和首页的一样,有两个地方需要操作,一个是模板文件里面添加广告的调用代码,另一个就是在全局自定义内容里面,添加具体的广告代码。详细操作方法如下:
1、文章列表页模板article/list.html里面搜索下面代码:
<div class="post-list">
{% archiveList articles with type="page" limit="30" %}
{%- for item in articles %}
我的自己改成了30了,默认的是10,即默认的代码是
<div class="post-list">
{% archiveList articles with type="page" limit="10" %}
{%- for item in articles %}
在这三行代码的上一行,添加广告调用代码:
<div class="post-item">{% diy with name="Lmwzlbksgg" %}</div>
注:Lmwzlbksgg的含义是 栏目文章列表开始广告。
2、添加广告代码。
在网站后台,【后台设置】,有一个【自定义内容】,我们点击【添加参数】即可。
备注:栏目文章列表开始广告
参数名:Lmwzlbksgg
字段类型:多行文本
默认值:(填写你的广告代码)
我下面的代码,供大家参考吧:
<object data="https://img.olzz.com/lmwzlbks/" width="100%" height="100%" type="text/html">栏目文章列表开始广告</object>
同理,文章列表开头广告,添加完毕了,就添加文章列表结束广告了。
3、文章列表页模板article/list.html里面搜索下面代码:
{% include "partial/pagination.html" %}
</div>
{% include "partial/sidebar.html" %}
在这个代码的上一行添加,广告调用代码:
<div class="post-item">{% diy with name="Lmwzlbjsgg" %}</div>
添加以后,该区域的代码如下:
{% endfor %}
{% endarchiveList %}
</div>
<div class="post-item">{% system with name="Lmwzlbjsgg" %}</div>
{% include "partial/pagination.html" %}
</div>
{% include "partial/sidebar.html" %}
</div>
{% endblock %}
4、添加广告代码。
在网站后台,【后台设置】,有一个【自定义内容】,我们点击【添加参数】即可。
备注:栏目文章列表结束广告
参数名:Lmwzlbjsgg
字段类型:多行文本
默认值:(填写你的广告代码)
我下面的代码,供大家参考吧:
<object data="https://img.olzz.com/lmwzlbjs/" width="100%" height="100%" type="text/html">栏目文章列表结束广告</object>