WordPress博文转成Jekyll和Farbox博客最简单方法

最近两年来,所谓的静态博客有抬头的趋势,尤其是在程序员博客这个圈子里,大有WordPress动态博客程序就是垃圾的感觉。 如果你也想使用静态博客,比如用Jekyll, OctoPress建立博客,可能会发现建立过程并不容易。对于WordPress博主而言,博客迁移转换也不容易,官方推荐exitwp使用Git命令去完成转换。这对于不懂Git命令有没有相应Rubby程序环境的人来说,无异于天书。 ...

2014-08-10 · 3 分钟 · 1310 字 · 土木坛子

在网站中插入Google站内搜索栏

如何在网页上插入Google搜索框?直接在需要插入的地方添加如下HTML代码: <form method="get" action="https://www.google.com/search"> <div style="border:1px solid white; padding:4px;width:20em;"> <table border="0" align="center" cellpadding="0"> <tr><td> <input type="text" name="q" size="20" maxlength="255" value="" /> <input type="submit" value="搜索" /></td></tr> <tr><td align="center" style="font-size:100%"> <input type="radio" name="sitesearch" value="tumutanzi.com" checked />土木坛子 <input type="radio" name="sitesearch" value="" />Google <br /> </td></tr></table> </div> </form> 上次,我用Google自定义搜索取代了WordPress系统自带的搜索栏,后来发现Google自定义搜索JavaScript代码的确影响网站的加载速度,于是又换回了WordPress的自带搜索,可惜WordPress自带的搜索功能只能搜索博文内容,无法搜索留言评论内容。 考虑到土木坛子上的留言已经超过20,000条,内容加起来比700多篇博文还要多,我觉得有必要使用Google站内搜索,于是找到了以上代码插入到网站中,替代WordPress自带搜索功能——直接在主题“小工具”选项中增加“文本”一栏,将代码填进去即可。提交搜索内容后,这个搜索框会自动跳转到Google主页搜索整个网站,也可以选择搜索整个互联网。

2014-07-12 · 1 分钟 · 414 字 · 土木坛子

禁用Google网络字体提高网站加载速度

Update: WordPress 技巧:禁用 Google Fonts,加快 WordPress 后台打开速度:将下面的代码放到当前主题的 functions.php 文件: add_filter( 'gettext_with_context', 'wpjam_disable_google_fonts', 888, 4); function wpjam_disable_google_fonts($translations, $text, $context, $domain ) { $google_fonts_contexts = array('Open Sans font: on or off','Lato font: on or off','Source Sans Pro font: on or off','Bitter font: on or off'); if( $text == 'on' && in_array($context, $google_fonts_contexts ) ){ $translations = 'off'; } return $translations; } 最近,Google在国内访问拜GFW神威而抽风,不仅仅是Google的搜索和GMail邮件服务,其它的Google相关服务也受到影响,比如Google Font网络字体。 ...

2014-06-11 · 2 分钟 · 796 字 · 土木坛子

Fixing Google Custom Search Engine Monetization Saving Issue

As a blogger using WordPress, I recently switched to Google Custom Search Engine instead of the default search box, just to give better user experience when searching the whole blog. Google Custom Search Engine not only index the posts of a blog, but also the comments left by readers who often bring nice content for a blog. However, there is a slight disadvantage of Google Custom Search Engine compared with the search box of WordPress. Google Custom Search shows advertisment based on the queries searched. Of course, it is comprehensible that Google relies on ads revenue whenever offers “FREE” services to users. ...

2014-02-28 · 1 分钟 · 333 字 · 土木坛子