大菠萝

大菠萝(Diablo)乃暗黑之王

BlogEngine添加Technorati标签

Technorati是一家国外的公司提供的一个搜索引擎,用来搜索blog内容。它主要提供的功能有三项,关键字搜索,tags搜索和引用链接搜索。在Windows Live Writer里可以直接添加Technorati标签,可是用起来很麻烦,不够原生态。

目标:给BlogEngine添加Technorati标签。

实施:

打开Web\Control\PostViewBase.cs源代码,修改TagLinks()方法。修改后代码为

 protected virtual string TagLinks(string separator,string path)
{
if (Post.Tags.Count == 0)
return null;
string[] tags = new string[Post.Tags.Count];
string link = "{2}";
for (int i = 0; i < Post.Tags.Count; i++)
{
string tag = Post.Tags[i];
tags[i] = string.Format(CultureInfo.InvariantCulture, link, path, HttpUtility.UrlEncode(tag), HttpUtility.HtmlEncode(tag));
}
return string.Join(separator, tags);
}

重新编译下核心。打开对应模板的\themes\Standard\PostView.ascx文件,直接在调用TagLinks()时增加一个网址即可。比如Technorati的为http://technorati.com/tag,修改后代码为:

 

Tags: <%=TagLinks(", ","/?tag=") %>

Tags: <%=TagLinks(", ","http://technorati.com/tag") %>

<%=CategoryLinks(" | ") %>

更新的时候记得要更新Dll文件。

Tags:|

by benben 6/15/2008 8:24:00 AM 固定连接 | Comments(2)| 程序设计

Comments

ebum 6/15/2008 9:27:42 PM

这样在live writer里向technorati添加标签了~
更新那个dll文件?

benben 6/16/2008 11:11:50 AM

@ebum 这个需要重新编译Core的。所以要把编译后的dll更新到网站中。


留言





如果留言不成功请联系ben#119797.com