home » 互联网络 » 今天做了个MyTags页面

最近我发现百度,Google,雅虎好像都对我的tags 比较感兴趣 ,主页右边栏的tags都被抓录。

不经意中,我想到该针对这一点好好优化一下。

我得做个MyTags页面,更好的吸引一下爬虫和蜘蛛。

建一个MyTags页面很简单,大家也跟着我做一个吧,这也算一个小小的SEO优化吧。

首先建一个MyTags页面的模板文件如mytags.php,就根据你的主题文件中的page.php做修改。
打开page.php,在最开头加上如下代码:
<?php
/*
Template Name: MyTags Page Template PAGE
*/
?>

这是一串声明代码。

我没有安装任何有关 tag 的插件,所以就用Wp自带的函数<?php wp_tag_cloud(); ?>来做。

我改好后的MyTags Page完整代码如下:


<?php
/*
Template Name: MyTags Page Template PAGE
*/
?>

<?php get_header(); ?>

<div id="content">

 <div id="contentleft">
    <div class="postarea">
    <h2>Tag Archive</h2>
    <?php wp_tag_cloud('number=800'); ?>
    </div> 
 </div>

<?php include(TEMPLATEPATH."/sidebar.php");?>

</div>

<?php get_footer(); ?>

以上的请根据自己的主题文件做修改。

我在wp_tag_cloud();函数中加了number=800,也就是显示800条标签。如果你不加这个就只会显示跟你首页一样多的标签数(只有20多个)。你有更多的标签可以设置number的值为更大即可。

将mytags.php上传到主题目录。

登录管理后台新建一个MyTags页面,选择刚刚做的MyTags Page Template PAGE为模板,就OK了。

看看我的tags页面:http://www.99xunle.com/mytags

最后希望爬虫和蜘蛛多多光顾吧。

Tags: 标签:, , ,
本博客所有文章如果没加特殊说明均为原创,如需转载引用请注明出处
[重阳博客:http://www.99xunle.com/archives/604]
随机文章 相关文章

10 Responses to “今天做了个MyTags页面”

  1. 不分页?要做就做个分页的

    Reply

    重阳  2009-06-09   回复:

    等标签多了以后再做分页的

    Reply

  2. 哈哈,照着你的教材,我也做了一个,谢啦!
    http://www.53hi.com/tags/

    Reply

  3. :mrgreen: :oops: :?: :twisted: :arrow: 这几个表情不错!

    Reply

  4. 做的很棒啊!

    Reply

  5. 愚人路过,只懂凑热闹!

    Reply

  6. 学习一下,我这儿也是经常收录tag

    Reply

  7. 对于引百度蜘蛛,除了做关键字我还没有什么好的方法,这个貌似是放在内页

    Reply

  8. 要记得用新建的MyTags Page Template PAGE为模板

    Reply

    小辉  2009-06-03   回复:

    来学习了

    Reply

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>