1、文章 设置,使得对搜索引擎足够友好

【博客首页】---> 博客名称 - 博客描述
【归档页面】---> XXXX/XX - 博客名称
【文章页面】---> 文章标题 - 博客名称
【独立页面】---> 页面标题 - 博客名称
【分类页面】---> 分类名称 - 博客名称
【标签页面】---> 标签 - 博客名称

< ><?php if($this->is(\'index\')): ?><?php $this->options-> (); ?>-<?php $this->options->de ion(); ?>
<?php elseif($this->is(\'archive\')): ?><?php $this->archive (\'/\',\'\',\' - \'); ?><?php $this->options-> (); ?>
<?php else: ?><?php $this->archive (\'\',\'\',\' - \'); ?><?php $this->options-> (); ?><?php endif; ?></ >

附论坛的两种不同的设置:

【博客首页】博客名称
【独立页面】页面标题 - 博客名称
【分类页面】分类名称 - 博客名称
【标签页面】Tag: 标签 - 博客名称
【存档页面】存档: XXXX年XX月 - 博客名称
【其它(日志页)】页面标题

< >
<?php if ($this->is(\'index\')){$this->options-> ();}
elseif($this->is(\'page\')){$this->archive (\'\',\'\',\' - \');$this->options-> ();}
elseif($this->is(\'category\')){$this->archive (\'\',\'\',\' - \');$this->options-> ();}
elseif($this->is(\'tag\')){$this->archive (\'\',\'Tag: \',\' - \');$this->options-> ();}
elseif($this->is(\'archive\')){$this->archive (\'年\',\'存档: \',\'月 - \');$this->options-> ();}
else{$this->archive (\'\',\'\',\'\');}?>
</ >
< ><?php $this->archive (\'\', \'\', \' - \'); ?><?php $this->options-> (); ?>-<?php $this->options->de ion();?></ >

2、相关文章的调用

<?php $this->related(5)->to($relatedPosts); ?>
<?php if ($relatedPosts->have()): ?>
<?php while ($relatedPosts->next()): ?>
<li>
<a href=\"<?php $relatedPosts->perma (); ?>\"  =\"<?php $relatedPosts-> (); ?>\"><?php $relatedPosts-> (); ?></a> <small class=\"info\"><strong><?php $relatedPosts->author(); ?></strong> post in<?php $this->date(\'Y-m-d H:i:s\'); ?></small>
</li>
<?php endwhile; ?>
<?php else : ?>
<li>No Related Post</li>
<?php endif; ?>

3、输出所有Tags

<?php $this->widget(\'Widget_ s_Tag_Cloud\') ->parse(\'<span class=\"tagcloud\"><a href=\"{perma }\">{name}</span></a>\'); ?>

4、分页只显示新文章、旧文章

<?php $this->page (\'? 新文章\',\'prev\'); ?>
<?php $this->page (\'旧文章 ?\',\'next\'); ?>

5、测边栏每月归档后面显示文章数

<?php $this->widget(\'Widget_Contents_Post_Date\', \'type=month&format=Y年m月\')
->parse(\'<li><a href=\"{perma }\">{date}</a> <span id=\"ignore\">({count})</span></li>\'); ?>

6、复制文章时带版权

<  type=\"text/ \">
document.body.  = function () { setTimeout( function () { var text = clipboardData.getData(\"text\"); if (text){ text = text + \"\\r\\n本篇文章来源于<?php $this->options-> (); ?>|<?php $this->options->siteUrl(); ?>,原文链接:\"+location.href; clipboardData.setData(\"text\", text); } }, 100 ) }
</ >

标签云

<?php $this->widget(\'Widget_ s_Tag_Cloud\', \'ignoreZeroCount=1&limit=20′)->to($tags); ?>
<?php while($tags->next()): ?>
<a href=”<?php $tags->perma (); ?>”><?php $tags->name(); ?></a>
<?php endwhile; ?>

最新文章

<?php $this->widget(\'Widget_Contents_Post_Recent\')->to($post); ?>
<?php while($post->next()): ?>
<a href=”<?php $post->perma (); ?>”  =”<?php $post-> (); ?>”>
<?php $post-> (25, \'…\'); ?></a>
<?php endwhile; ?>

相关内容

<?php $this->related(5)->to($relatedPosts); ?>
<?php while ($relatedPosts->next()): ?>
<a href=”<?php $relatedPosts->perma (); ?>”  =”
<?php $relatedPosts-> (); ?>”><?php $relatedPosts-> (); ?></a>
<small><strong><?php $relatedPosts->author(); ?></strong> post in
<?php $this->date(\'Y-m-d H:i:s\'); ?></small>
<?php endwhile; ?>

日期归档

<?php $this->widget(\'Widget_Contents_Post_Date\', \'type=month&format=F Y\')->parse(\'<li><a href=”{perma }”>{date}</a> ({count})</li>\'); ?>

友情链接 要装插件

<?php PageTo s::output(\' s\', \'h3\', \'ul\'); ?>

头部

<?php $this->keywords(\'_\'); ?> //关键词
<?php $this->options-> (); ?> //站点名称
<?php $this->options->de ion(); ?> //站点描述
<?php $this->archive (); ?> //标题
<?php $this->options->themeUrl(\'ie.css\'); ?> //模板路径
<?php $this->options->siteUrl(); ?> //主页网址
<?php $this->options->feedUrl(); ?>
<?php $this->options->commentsFeedUrl(); ?>
<?php $this->pageNav(); ?> //分页
<?php $this->options->generator(); ?> //版本号

文章页面

<?php $this-> (); ?> //标题
<?php $this->category(\',\'); ?> //分类
<?php $this->tags(\', \', true, \'\'); ?> //标签
<?php $this->date(\'F jS, Y\') ?> //时间
<?php $this->content(); ?> //内容
<?php $this->thePrev(\'&laquo; %s\', \'\'); ?> //上一篇
<?php $this->theNext(\'%s &raquo;\', \'\'); ?> //下一篇

全部文章列表代码,可以应用在任何地方:

<?php $this->widget(\'Widget_Contents_Post_Recent\', \'pageSize=10000\')->parse(\'<li>{year}-{month}-{day} : <a href=\"{perma }\">{ }</a></li>\'); ?>

全部标签集列表

<?php $this->widget(\'Widget_ s_Tag_Cloud\')
                ->to($taglist); ?><?php while($taglist->next()): ?>
<li><a href=\"<?php $taglist->perma (); ?>\"  =\"<?php $taglist->name(); ?>\"><?php $taglist->name(); ?></a></li>
<?php endwhile; ?>

全部日志数量

<?php $stat = Typecho_Widget::widget(\'Widget_Stat\') ;echo \".$stat->PublishedPostsNum.\"; ?>
使用这个方法,可以自定义首页的文章显示条数,以及自定义分类文章显示:
function themeInit($archive) {
    if ($archive->is(\'index\')) {
        $archive->parameter->pageSize = 10; // 自定义条数
    }
}

或者:

function themeInit($archive) {
    if ($archive->is(\'category\', \'default\')) {
        $archive->parameter->pageSize = 10; // 自定义条数
    }
}

调用某分类文章,pageSize是数量,mid是分类号

<?php $this->widget(\'Widget_Archive@index\', \'pageSize=6&type=category\', \'mid=1\')
                ->parse(\'<li><a href=\"{perma }\">{ }</a></li>\'); ?>

侧栏评论忽略博主评论

<?php $this->widget(\'Widget_Comments_Recent\',\'ignoreAuthor=true\')->to($comments); ?>
收藏 打印