1,121° 2013343字0条评论

Blogger 在标签页和存档页中只显示标题

标签页面显示某个标签下的所有文章,存档页面显示某个月的所有文章,如果全部都显示内容,未免过于冗长。所以以文章列表的形式会更加友好。今天要介绍的就是如何在标签页和存档页只显示标题的方法。效果如下。参考文章 Showing only post titles on archive and label pages

在标签页只显示标题
在标签页只显示标题

步骤零:备份模板

步骤一:编辑 HTML 代码

搜索 <b:include data='post' name='post'/>,替换为以下代码:

<!--Label and archive page title only hack-->
<b:if cond='data:blog.searchLabel'>
    <h3 class='title-only'><a expr:href='data:post.url'><data:post.title/></a></h3> 
<b:else/> 
<b:if cond='data:blog.pageType == "archive"'> 
    <h3 class='title-only'><a expr:href='data:post.url'><data:post.title/></a></h3> 
<b:else/> 
<b:include data='post' name='post'/> 
</b:if> 
</b:if>
<!--/Label and archive page title only hack-->

步骤二:修改样式

.title-only 控制题目样式,比如我的代码如下:

.title-only {
    font-size: 18px;
    padding: 15px 0 25px 210px;
    line-height: 1;
    border-bottom: 1px solid #eee;
}

推荐使用 Chrome 或者 Firefox 按 F12 在线修改,确定样式后复制到 css 里更快捷。

步骤三:保存模板

大功告成!

EOF
576°
阪大中国人留学生中秋晚会
Comments
Write a Comment
点击加载Disqus