打开文件 `/include/taglib/channel.lib.php`,找到以下代码片段:
if($needRel)
{
$row['sonids'] = GetSonIds($row['id'], 0, false);
if($row['sonids']=='') $row['rel'] = '';
else $row['rel'] = "id']}'";
}
在此代码段下方新增以下内容:
$row['target'] = ($row['ispart']==2) ? "target = ''_blank''" : "target = ''_self''"; // 新窗口打开
$row['nofollow'] = ($row['ispart']==2) ? "rel = ''nofollow''" : "rel = ''follow''"; // nofollow 属性
继续向下查找以下代码:
$linkOkstr = str_replace("'~typename~'",$row['typename'],$linkOkstr);
在其下方新增以下代码:
$linkOkstr = str_replace("'~target~'",$row['target'],$linkOkstr);
$linkOkstr = str_replace("'~nofollow~'",$row['nofollow'],$linkOkstr);
完成上述修改后,在导航标签中可以使用新增的 `[field:target/]` 和 `[field:nofollow/]` 标签。这两个标签将根据实际情况自动应用。例如:
{dede:channel type='self' currentstyle="~typename~ "}
[field:typename/]
{/dede:channel}