phpcms SEO

航空母艦發表於2016-06-15

大家應該都是在header標頭檔案裡寫上{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}這個的吧。

 

這個$SEO的變數是在/phpcms/modules/content/index.php裡的。所以要找到這個$SEO這個變數。
$SEO = seo($siteid, $catid, $title,$setting['meta_description'],$keywords);
seo這個函式所在檔案/phpcms/libs/functions/global.func.php
function seo($siteid, $catid = '', $title = '', $description = '', $keyword = '') 

 關於標題有重複,可以修改一下seo META Title這樣看起來會好看點

$seo ['title'] = (isset ( $title ) && ! empty ( $title ) ? $title : '') . (isset ( $cat ['setting'] ['meta_title'] ) && ! empty ( $cat ['setting'] ['meta_title'] ) ? $cat ['setting'] ['meta_title'] . ' - ' : (isset ( $cat ['catname'] ) && ! empty ( $cat ['catname'] ) ? $cat ['catname'] . ' - ' : ''));

 修改成:

$seo ['title'] = (isset ( $title ) && ! empty ( $title ) ? $title . '_' : '') . (isset ( $cat ['setting'] ['meta_title'] ) && ! empty ( $cat ['setting'] ['meta_title'] ) ? $cat ['setting'] ['meta_title'] : (isset ( $cat ['catname'] ) && ! empty ( $cat ['catname'] ) ? $cat ['catname']: ''));

 找到/phpcms/modules/content/class/html.class.php

$SEO = seo($siteid, $catid, $title,$setting['meta_description'],$keywords);

欄目SEO

$sites = getcache('sitelist',  'commons');
$site = $sites[$siteid];
$seoTitle = '店鋪_';
$SEO = seo($siteid, 0, $seoTitle.$site['site_title']);

 

相關文章