对于“META标签的用途、功能和属性”大家都已耳熟能详了,其中有个meta标签是网页描述,如下:
<meta name="description" content="荆棘鸟's Blog" />
之前,我都是静态定义这个meta description的,前些天偶然发现,一些论坛和CMS,是用文章标题动态描述的,例如:
<meta name="description" content=" 经典论坛 遇到一个难题,请高手们指点啊。
我想在页面上加一个图片固定在底部,页面跳转变换标志始终在页面上,如图所示。- Discuz! Board" />
于是,把我的博客meta description标签重新定义一下。
首页,default.html
<meta name="description" content="<#ZC_BLOG_TITLE#>,<#ZC_BLOG_SUBTITLE#>">
栏目页,catalog.html
<meta name="description" content="<#BlogTitle#> <#ZC_BLOG_TITLE#>">文章页,single.html
<meta name="description" content="<#BlogTitle#> <#ZC_BLOG_TITLE#>">搜索页,search.html
<meta name="description" content="<#BlogTitle#> <#ZC_BLOG_TITLE#>">TAG页,我没用,有兴趣的自己研究一下吧。
说明一下用到的z-blog标签作用:
<#ZC_BLOG_TITLE#> 博客名称
<#ZC_BLOG_SUBTITLE#> 博客子标题
<#BlogTitle#>
在文章页,就是文章标题;
在栏目页,就是栏目名称;
在搜索页,就是搜索关键字名称;
如果想和经典论坛一样,用文章摘要内容描述,可以用<#article/intro#>这个标签来替代。
z-blog其它更多标签名称,请看Z-Blog模版标签库说明。