请问织梦导航循环指定栏目出现 rel=“nofollow”的方法
方法一:
- 使用条件判断:
- 在导航标签中使用条件判断,指定某些栏目输出
rel="nofollow"
。
{dede:channel type='top' row='8'} <a href="[field:typelink/]" [field:id runphp='yes']if (@me == 9) @me = 'rel="nofollow"'; else @me = '';[/field:id]>[field:typename/]</a> {/dede:channel}
- 在导航标签中使用条件判断,指定某些栏目输出
方法二:
- 使用自定义函数:
- 在
include/extend.func.php
文件中添加自定义函数。
function is_nofollow($id) { switch ($id) { case '1': case '2': case '3': case '4': $nofollow = 'rel="nofollow"'; break; default: $nofollow = ''; break; } return $nofollow; }
- 在导航标签中调用自定义函数。
{dede:channel type='top' row='8'} <a href="[field:typelink/]" [field:id function=is_nofollow(@me)/]>[field:typename/]</a> {/dede:channel}
- 在
更新时间:2025-04-11 01:28:31
上一篇:请问网站后台怎么连接数据库
转载请注明原文链接:https://www.muzicopy.com/suibi/7943.html