站长资源
中国站长网站

云优CMS/yunucms自定义标题优化写法

列表页原标题写法:

<meta name="keywords" content="<yunu:config name='seo_keywords'>">
<meta name="description" content="<yunu:config name='seo_description'>">
<title>{$category.title}-<yunu:config name="site_title"></title>

上面这种写法在后台栏目设置自定义标题时,是无法显示的,优化写法为

<title><if condition="strlen($category.seo_title) neq 0">{$category.seo_title}<else/>{$category.title}-<yunu:config name="site_title"></if></title>
<meta name="keywords" content="{$category.seo_keywords}">
<meta name="description" content="{$category.seo_desc}">

这样即可在不填写自定义标题时调用默认标题,填写自定义标题时调用自定义标题

补充:有的用户不知道详情页怎么处理,直接给出方法如下:

<title><if condition="strlen($content.seo_title) neq 0">{$content.seo_title}<else/>{$content.title}-<yunu:config name="site_title"></if></title>
<meta name="keywords" content="{$content.seo_keywords}">
<meta name="description" content="{$content.seo_desc}">

本文出处:来自互联网信息共享,请勿相信收费信息站长资源 » 云优CMS/yunucms自定义标题优化写法

评论 抢沙发

评论前必须登录!