Using Google Code to host scripts for your Blogger Template

Many methods used to customize our Blogger templates require the use of JavaScript. At present, we can only upload images and video to Blogger. So if we need to use JavaScript we must find alternative hosting for these files.

When using JavaScript in my own Blogger templates and customizations, I prefer to host the required scripts using Google Code's Project Hosting. In this post, I'll explain the methods and best practises for using Google Code to serve JavaScripts for your own Blogger tweaks.

First things first!

Project Hosting on Google Code is intended for collaborative development on open source projects. Rather than being used as a substitute for regular web hosting, it is best suited to hosting shared projects.

All projects hosted on Google Code are Open Source, and are available for anyone to view or download. Various licenses are used for files served by Project Hosting including:

The most productive method is to search for the file name of the script you need. For example, when searching for the minified jQuery library, I'd use the term "jquery.min.js".

If the file you need to link to is already available, you can link to this in your template (or gadget code) as detailed below.

Hosting your own files with Google Code

If you find the file you require is not available, or would like to use Google Code to host your own files, you'll need to create a new project.

Fill in all required details on the Create a Project page and choose an appropriate Public Domain license from the drop-down list. All files you consequently upload to your project will adopt this same license.

The name chosen for your project will become part of the URL for your project's home page (e.g. http://code.google.com/p/NAME-OF-PROJECT) and should contain no spaces.

You can also choose to add labels to help others find your project.

To upload files to your new Google Code hosted project, click the Downloads tab, then use the New Download link:

On the next page, you'll be able to add a one-line description of your file, plus a detailed description for information:

Upload your file using the Browse button.

Labels on this page affect how your download is presented on the main project page. Place your cursor in one of the Label boxes to be presented with a list of choices and select any which are applicable (or none if you prefer):

Linking to files hosted by Google Code

Once you've uploaded a file to Google Code (or have found a file to which you'd like to link) you'll need to locate it's direct URL.

In most cases you'll find the script you need is included in a list of downloads on its project page, like this:

When you click the linked title of the file you want to use, you'll be taken to it's dedicated page which includes details of the file and the all-important direct file link:

You'll need to right click this link and choose to copy the link location. Then you'll be able to paste the URL which links directly to the file for use in your own Blogger projects.

Of course, the way you need to use this direct link will depend entirely on how you need to use the hosted file.

For example, when implementing a jQuery slideshow to your Blogger template, you'll need to replace the URLs of script files placed in the <head> section of your Blogger template. If linking to a PDF hosted on Google code, you can simply paste it in place of the URL in the link tags.

In future tutorials posted here on Blogger Buster, I'll be referring to this method often as from now on I'll be using Google Code as my main repository for scripts and Blogger projects.

Find us on Facebook

Follow by Email

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog: