Recently while debugging the issue with my WordPress feed, I found out that the Plugin which I was using to display files from my Github Gist was highly unoptimized. As promised, I created a Plugin to do it properly.
While working on this new Plugin, I felt that it would be really nice to embed Github files as well in addition to embedding gist.
My search lead to a Google app engine based solution called Gist-it. I really liked it, but one problem with it was that it was not supporting embedding particular regions of the file. So during the Yahoo HackU last week, I hacked on it and added support for specifying line numbers.
I also updated my WordPress Plugin to support gist-it urls as well.
Download & Usage
You can download the latest version of the Plugin from the Plugin’s home page. The Plugin’s home page also has detailed examples of different ways by which you can embed gist or Github files in your WordPress blog posts or pages.
If you have any comments or if you want to report any bugs, please leave a comment below.
I would be posting updates about this Plugin in my blog and in Twitter. If you want to be informed when new version of this Plugin is released, then you can either subscribe to this blog’s RSS feed or follow me in Twitter.
Posted in WordPress
Tagged gist, github, Plugin, WordPress, wp-github-gist
Recently I got an email from my friend Sudheer, saying that the feedburner feed of my blog is not working. I thought it might be some small issue, but it took me more than a couple of hours to fix it. As usual, I thought of documenting it since it was an interesting problem and also someone who has the same problem might also find it useful.
WordPress feed timeout
I started the debug process by logging into Feedburner dashboard. Feedburner reported that it is not able to fetch my blog’s feed url. When I tried to open the feed url directly in browser it was loading, but it took a couple of minutes for WordPress to generate it. But both feedvalidator and feedburner said that the feed times out.
My website was loading properly and my error log was empty. I tried lot of different things but was not able to figure out why the feed was timing out.
Increasing memory used by WordPress
After a couple of web searches, I landed on a old forum thread, which stated that we should try to increase the amount of memory used by WordPress. I tried doing that as well, but it didn’t make difference
Reducing post count in feed
Then I tried to reduce the number of recent items that were shown in my feed to 10 from the default value of 25. The feed was getting generated in some decent time and was able to let feedburner pick up my feed. But it still didn’t solve my original issue.
After some more debugging, I found the root cause of the issue. An unoptimized Plugin was the real culprit.
I was using github’s gist to store the code samples that I use in my blog posts and used a Plugin to embed the code directly from github. The advantage of this approach is that, there is one centralized repository for my code samples with versioning and also github provides nice syntax highlighting.
The Plugin was making curl request to github to retrieve the code sample and it so happened that most of my last 25 blog posts had code samples and some blog posts even had around three code embeds.
The problem with the Plugin was that, it was not using WordPress’s built-in HTTP request object and also it was not caching any of the response that it got from the curl request. I quickly rewrote the Plugin and WordPress was immediately able to serve the feed in less than a second. (
Will be releasing the Plugin pretty soon) Update: You can find the Plugin in its homepage
So if you are also facing timeout issues with your WordPress feed, then try the following
- Try increasing the memory used by WordPress
- Try reducing the number of blog posts that are disabled in your feed.
- If nothing works, then it’s mostly because of some unoptimized Plugin.
Posted in WordPress
Tagged feed, FeedBurner, github, WordPress, wp-github-gist