Zblog的Lucky模板TKD优化
下述代码优化了Lucky模板中的Header.php和Photo.php的TKD,本文作为本人备份用途。
{if $zbp->Config('Lucky')->seo=="b"} <title>{$name}|{$subname}</title> {else} <title> {if $type=="index"}{$name}|{$subname} {elseif $type=="category"&&$page=="1"}{$category.Name} {if $category.Metas.XF_Addtitle}-{$category.Metas.XF_Addtitle}{/if}-{$name} {elseif $type=="category"&&$page>"1"}{$category.Name}{if $category.Metas.XF_Addtitle}-{$category.Metas.XF_Addtitle}{/if}-{$name}-第{$page}页 {elseif $type=="tag"&&$page=="1"}{$tag.Name}{if $tag.Metas.XF_Addtitle}-{$tag.Metas.XF_Addtitle}{/if}-{$name} {elseif $type=="tag"&&$page>"1"}{$tag.Name}{if $tag.Metas.XF_Addtitle}-{$tag.Metas.XF_Addtitle}{/if}-{$name}-第{$page}页 {elseif $type=="date"&&$page=="1"}{$title} {$name}{elseif $type=="date"&&$page>"1"}{$title} {$name} {elseif $type=="article"}{$title}{if $article.Metas.XF_Addtitle}-{$article.Metas.XF_Addtitle}{/if}-{$name} {elseif $type=="page"}{$title}{if $article.Metas.XF_Addtitle}-{$article.Metas.XF_Addtitle}{/if}-{$name}{if $zbp->Config('Lucky')->page_subname=="a"}{/if} {else} {$title}-{$name} {/if} </title> {if $type=='index'} <meta name="keywords" content="{$zbp->Config('Lucky')->keywords}" /> <meta name="description" content="{$zbp->Config('Lucky')->description}" /> {elseif $type=='page'} {if !empty($article->Metas->XF_Keywords)} <meta name="keywords" content="{$article.Metas.XF_Keywords}"/> {else} <meta name="keywords" content="{$title},{$name}"/> {/if} {if !empty($article->Metas->XF_Description)} <meta name="description" content="{$article.Metas.XF_Description}" /> {else} {php}$description = preg_replace('/[\r\n\s]+/', ' ', trim(SubStrUTF8(TransferHTML($article->Content,'[nohtml]'),135)).'...');{/php} <meta name="description" content="{$title}是{$name}中的一篇文章单页.内容关于{$description}"/> {/if} <meta name="author" content="{$article.Author.StaticName}" /> {elseif $type=='article'} {if !empty($article->Metas->XF_Keywords)} <meta name="keywords" content="{$article.Metas.XF_Keywords}" /> {else} <meta name="keywords" content="{foreach $article.Tags as $tag}{$tag.Name},{/foreach}" /> {/if} {if !empty($article->Metas->XF_Description)} <meta name="description" content="{$article.Metas.XF_Description}" /> {else} <meta name="description" content="{$article.Title}是{$name}中一篇关于{foreach $article.Tags as $tag}{$tag.Name}{/foreach}的文章,欢迎您阅读和评论,{$name}" /> {/if} {elseif $type=='category'} {if !empty($category->Metas->XF_Keywords)} <meta name="keywords" content="{$category.Metas.XF_Keywords}" /> {else} <meta name="keywords" content="{$title},{$name}"> {/if} {if !empty($category->Metas->XF_Description)} <meta name="description" content="{$category.Metas.XF_Description}" /> {else} <meta name="description" content="{$title}是{$name}中的分类.{$category.Intro}"> {/if} {elseif $type=='tag'} {if !empty($tag->Metas->XF_Keywords)} <meta name="keywords" content="{$tag.Metas.XF_Keywords}" /> {else} <meta name="keywords" content="{$title},{$name}"> {/if} {if !empty($tag->Metas->XF_Description)} <meta name="description" content="{$tag.Metas.XF_Description}" /> {else} <meta name="description" content="{$title}是{$name}中的标签.{$tag.Intro}"> {/if} {else} <meta name="Keywords" content="{$title},{$name}" /> <meta name="description" content="{$title}-{$name}" /> {/if} {/if}
上述代码仅供线下编辑,在实际运用的时候,需要将代码压缩,否则Title会大段空白!