在Blog中手动添加网摘链接
如果你以单页方式浏览本站的文章,会发现文章内容的下方有一排图标链接,点击图标就能将文章收录到你所使用的网络书签(国内一般叫网摘)服务中,比如Del.icio.us,Digg,Furl等,对于Wordpress平台,通常这个功能都是由插件来完成的,我所知道的比较著名的有Blogit和Sociable,但如果你不想使用插件,这些工作也完全可以手工完成,你无须使用Javascript,所要做的只是在适当的位置添加几个链接而已:wink:
下面就以Del.icio.us为例谈谈如何在Blog中加入提交网摘链接(只对应基于Wordpress的Blog):
- 所有步骤中最关键的一点是找出提交网摘服务所需要的链接代码,各个网摘服务的代码并不相同,幸好它们在自己的网站帮助中都会有相应的工具或说明,比如del.icio.us的帮助中就给出了针对Blogger使用的提交文章代码,你只需要将该段代码复制到主题模板文件中就可以了,我会在下面列出几个流行的网摘服务所需的代码,当然你也可以自己去相应的网站探索:);
-
找到代码后,需要将它加入到模板文件中,通常使用单页(single.php)或页(page.php)模板文件,在Post loop内写入代码,如下:
<?php while (have_posts()) : the_post(); ?>
……
<?php the_content(’Read More »’); ?>
//在这里添加提交代码,比如del.icio.us的
<a href=”http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>” > 保存这篇文章到Delicious</a>
<?php endwhile; ?>
//其中<?php the_permalink(); ?>用来获取文章的永久链接,<?php the_title(); ?>用来获取文章的标题
如果你懂一些HTML或PHP语言,还可以再添加一些样式或其它功能,但现在基本上也够用了,具体效果可以参看我另外一个Blog。
常用网摘网站的链接代码:
Del.icio.us:
<a href=”http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>” > 保存这篇文章到Delicious</a>
Digg:
<a href=”http://www.digg.com/submit?phase=2&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>”>Digg it</a>
Furl:
<a href=”http://www.furl.net/storeIt.jsp?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>”>Furl it</a>
Blinklist:
<a href=”http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=<?php the_permalink(); ?>&Title=<?php the_title(); ?>”>Save this page</a>
MyYahoo!:
<a href=”http://myweb2.search.yahoo.com/myresults/bookmarklet?u=<?php the_permalink(); ?>&=<?php the_title(); ?>”>Add to My Yahoo!</a>
365Key:
<a href=”http://www.365key.com/storeit.aspx?t=<?php the_title(); ?>&u=<?php the_permalink(); ?>”>Add to 365Key</a>
和讯网摘:
<a href=”http://bookmark.hexun.com/post.aspx?title=<?php the_title(); ?>&url=<?php the_permalink(); ?>”>Add to hexun</a>
天极网摘:
<a href=”http://hot.yesky.com/dp.aspx?t=<?php the_title(); ?>&u=<?php the_permalink(); ?>”>Add to Yesky</a>
July 9th, 2006 at 5:43 pm
[...] 对于网络书签(网摘)服务大家应该不陌生了,在自己的Blog中加入这些网摘网站的链接可以使读者方便的保存喜欢的文章,提高网站的吸引力,对于基于Wordpress的Blog,这个功能通常由插件来完成,比如Blogit和Sociable,但其实你也可以手工添加此功能,并不复杂,看看我写的这篇文章吧 [...]
September 10th, 2006 at 9:53 am
[...] TechPush» Blog Archive : 在Blog中手动添加网摘链接 (tags: del.icio.us) [...]
October 1st, 2006 at 8:11 am
[...] 在Blog中手动添加网摘链接 Technorati Tags: Blog Blogger拜读 [...]
October 1st, 2006 at 8:22 am
国内的那几个都无法在WordPress显示
October 1st, 2006 at 10:39 am
[quote comment="394"]国内的那几个都无法在WordPress显示[/quote]
是我粗心,永久链接的代码应该是the_permalink,而国内那几处我少写了一个“_”,变成了the permalink,所以无法显示,现在我已经改过来了,多谢提醒:wink:
October 1st, 2006 at 11:13 am
你写的已经相当不错了,这些代码一个个找起来很费事。好在百度搜索你能排在很好的位置。
December 10th, 2006 at 8:20 pm
[...] 在Blog中手动添加网摘链接 [...]
January 13th, 2008 at 11:54 am
January 19th, 2008 at 1:55 am
February 1st, 2008 at 2:49 pm
February 14th, 2008 at 2:15 pm
March 7th, 2008 at 9:45 am