SEO for Movable Type 4.x
写于2008-10-21 @ 分类:Movable Type,搜索引擎优化 |评论(1)
上次说MT天生就是为SEO准备的,近乎完美。MT默认的模板中并未对keywords和description进行设置,不用担心,MT有主够完美的模板标签让你来进行设置,今天我们就来说说如何对Movable Type 4.x设置keywords and description。
Movable Type 4.X的模板引入了模块的概念,一个模块可以供多个模板来使用。所以在设置标签的时候要考虑到很多种情况,针对不同的模板设置不同的keywords and description。不能一概而论,事实上一概而论的话在重建模板的时候也不会通过的。:-) 。
keywords and description的设置在HTML Head这个模块中,我们先看看有那几个模板会用到HTML Head这个模块:Main index 、entry、page、Category Entry Listing、Archive Index,我使用的是Mid-Century template这个模板,也许每个人的模板不一样,其中包括这个模块的模板也不一样,你可以根据自己的情况来定。
先前我们说了根据每个不同的模板来设定不同的keywords and description,我们先来看看上面我们提到的每个模板都怎么设置:
Main index#
- <meta name="keywords" content="keywords1,keywords2,keywords3" />
- <meta name="description" content="<$mt:BlogDescription$>" />
Entry
- <meta name="keywords" content="<$mt:EntryKeywords$>" />
- <meta name="description" content="<$mt:EntryExcerpt$>" />
Page
- <meta name="keywords" content="<$mt:PageKeywords$>" />
- <meta name="description" content="<$mt:PageExcerpt$>" />
Category Entry Listing
- <meta name="keywords" content="<mt:Entries lastn="3"><mt:If name="__first__"><mt:EntryCategories glue=","><$mt:CategoryLabel $></mt:EntryCategories><mt:ElseIf name="__last__"><mt:EntryIfTagged>,<mt:EntryTags glue=","><$mt:TagName$></mt:EntryTags></mt:EntryIfTagged></mt:If></mt:Entries>" />
- <meta name="description" content="<mt:Entries lastn="3"><$mt:EntryTitle$>,</mt:Entries>" />
Archive Index
- <meta name="keywords" content="<mt:Entries lastn="3"><mt:If name="__first__"><mt:EntryCategories glue=","><$mt:CategoryLabel $></mt:EntryCategories><mt:ElseIf name="__last__"><mt:EntryIfTagged>,<mt:EntryTags glue=","><$mt:TagName$></mt:EntryTags></mt:EntryIfTagged></mt:If></mt:Entries>" />
- <meta name="description" content="<mt:Entries lastn="3"><$mt:EntryTitle$>,</mt:Entries>" />
前面两个也许很好理解,后面两个的基本相同,对于keywords,取前三篇文章的类别名称和Tag,对于description取前三篇文章的标题。
我们把上面的代码整理一下,并加上其他的元素,就可以得到一个比较完整的:
- <mt:If name="main_index"> /*首页的keywords和description的定义*/
- <meta name="robots" content="all" />
- <meta name="googlebot" content="index, follow" />
- <meta name="keywords" content="keywords1,keywords2,keywords3" />
- <meta name="description" content="<$mt:BlogDescription$>" />
- <mt:ElseIf name="archive index"> /*总归档的keywords和description的定义*/
- <meta name="keywords" content="<mt:Entries lastn="3"><mt:If name="__first__"><mt:EntryCategories glue=","><$mt:CategoryLabel $></mt:EntryCategories><mt:ElseIf name="__last__"><mt:EntryIfTagged>,<mt:EntryTags glue=","><$mt:TagName$></mt:EntryTags></mt:EntryIfTagged></mt:If></mt:Entries>" />
- <meta name="description" content="<mt:Entries lastn="3"><$mt:EntryTitle$>,</mt:Entries>" />
- <mt:ElseIf name="entry"> /*日志的keywords和description的定义*/
- <meta name="robots" content="all" />
- <meta name="googlebot" content="index, follow" />
- <meta name="keywords" content="<$mt:EntryKeywords$>" />
- <meta name="description" content="<$mt:EntryExcerpt$>" />
- <mt:ElseIf name="page"> /*页面的keywords和description的定义*/
- <meta name="robots" content="all" />
- <meta name="googlebot" content="index, follow" />
- <meta name="keywords" content="<$mt:PageKeywords$>" />
- <meta name="description" content="<$mt:PageExcerpt$>" />
- <mt:ElseIf name="Category Entry Listing"> /*按类别或日期归档页面的keywords和description的定义*/
- <meta name="keywords" content="<mt:Entries lastn="3"><mt:If name="__first__"><mt:EntryCategories glue=","><$mt:CategoryLabel $></mt:EntryCategories><mt:ElseIf name="__last__"><mt:EntryIfTagged>,<mt:EntryTags glue=","><$mt:TagName$></mt:EntryTags></mt:EntryIfTagged></mt:If></mt:Entries>" />
- <meta name="description" content="<mt:Entries lastn="3"><$mt:EntryTitle$>,</mt:Entries>" />
- </mt:If>


不错,兄弟研究的挺不错~