推荐商家:{naicha:merchants}
首页推荐位与商家列表页:字段的三级回落规则,以及「浏览量什么时候才加」。
适用范围:首页推荐位、商家列表页 merchants.html、商家详情页 merchant_detail.html。
基本写法
{naicha:merchants num="8" featured="1"}
<a href="{merchant.url}">{merchant.name}</a>
<img src="{merchant.show_shot}" alt="{merchant.show_name}">
{/naicha:merchants}
featured="1" 只取勾了「首页推荐」的(首页那一节用);不传则取全部显示中的(列表页用)。
字段
循环体里的字段(一条不漏)
这张表要分两栏看:原值是你自己填的(可能为空),展示值是引擎算好的回落结果。 模板里一律用展示值 —— 回落的规则只有引擎那一份,各套主题自己拼会拼出不一致。
{merchant.id}商家 id(拼 /merchants/{id} 详情地址用){merchant.name}你自己填的名称(没填就是空串){merchant.show_name}该显示的名称:自定义 → 自动抓的页面标题 → 网址,三级回落{merchant.url}网址(点「访问网站」跳这个){merchant.host}网址的域名部分(卡片上那行小字){merchant.intro}一句话简介(自己填的){merchant.logo} / {merchant.show_logo}原值 / 该显示的图标(没传时回落到自动抓到的站点图标){merchant.shot} / {merchant.show_shot}原值 / 该显示的主图:自己指定的优先,没有才用在线实时截图{merchant.shot_is_own}1 = 主图是你自己传的(不是第三方截图){merchant.hits}浏览量。只在点「访问网站」时 +1,打开详情页不加{merchant.is_auto}1 = 名称或图标里有自动抓来的,不是你填的{merchant.stale}自动抓的数据是不是该刷新了(超过 24 小时){merchant.fetched_txt}抓取时间文案,过期时会带上「已过期」;没抓过是空串{merchant.auto_title} {merchant.auto_icon} {merchant.auto_theme}自动抓到的原始值(调试回落规则时才需要){merchant.address} {merchant.email} {merchant.phone} {merchant.hours}地址 / 邮箱 / 电话 / 营业时间,都可以不填(空串){merchant.reviews}评价数一类的展示值{merchant.featured}1 = 勾了「首页推荐」{merchant.sort}排序值
⚠️
show_name 会回落成整个页面标题。
如果某条商家没填自定义名称,而它的页面标题又很长(比如一句广告语),
列表上就会出现一条特别长的名字,把卡片挤变形。
要么在填一个短名称,要么在模板里给它截断:
{merchant.show_name excerpt="18"}。
