Alexander Beletsky's development blog

My profession is engineering

Blogging with a GitHub and Blogspot? Ideas?

I do use Blogger as my blog engine and really like it. Right, as soon as you create your blog posts in HTML and do not use embedded editor it is perfectly fine! So, when I do new post I create a plain HTML in VS and after it is ready I copy paste it to blogspot and publish. Original HTML I commit special repository on github.

I liked that style of work as far I as I change nothing in posts. As I need change, I have to change original HTML, re-publish it on blogspot and commit again to github. After I did it several times, I started to think how to automate this? I came up this a simple idea, why do not load the content of post dynamically, by using a javascript?

It is no problem to do that, and I implemented a small script that performs exactly what I needed. I called this project GithubToBlogspot. Its description:

GithubToBlogspot is used for people who stores they blog article sources in HTML. Instead copy pasting HTML between blogspot and github, it should be possible to paste a simple script on a page and that script would load a content.

It utilized javascript GitHub API by:

First draft example looks like this,

<div id="content1" class="load" >
Loading your content, please wait...
<img src="" />
<script type="text/javascript">
  var __user = "alexanderbeletsky"; var __repo = "Blog"; var __sha = "16fe3ddf21925508490d91978cf581a13bc37b6c";
  var __path = "07112010/GitHubSocialCoding.htm";
  var __div = "content1";
  githubToBlogspot(__user, __repo, __path, __sha, __div);

* This source code was highlighted with Source Code Highlighter.

Code itself is also really simple: it opens the blob, reads its data as HTML, extracts the body and put body to target div. That’s it. All this done asynchronously, so as you open the blog you see progress image.. after data loaded it appears on screen.

But I haven’t taken into account several major considerations:

  • First, AJAX content is not crawlable by Google. It actually is, but requires a changes that could not be done, since you are on 3rd party blog engine.
  • Second, is with that dynamic loading RSS feed of blog will also be empty.

I still want to accomplish this. I was thinking about different solutions, but have no solid one.. Do you know is it possible to accomplish something similar with no drawbacks I mentioned above. It would be great if you share you ideas!