Langsung ke konten utama

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:
If you do need to upload scripts to Google Code for hosting, you need to be sure any license pertaining to the script allow the file to be distributed in the public domain.

Search for scripts before uploading your own

Before creating your own project on Google Code for the purpose of hosting files, be sure to check if the script has already been made available by another project.

You can use the Google Code search page to check if the script you'd like to use is already hosted:

 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):


Finally, click the Submit File button to upload your file to Google code.

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 , 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.

Tools on Google Code

Back in 2009 I launched the Tools project on Google Code to act as a repository for scripts and files relevant to Blogger-based development.

This project now includes the vast majority of files used for interactive JavaScript features (e.g. slideshows and galleries); Blogger Gadgets, free Blogger templates and eBooks.




Did you find this post useful?

Rather than focusing on a customization tutorial in this article, I've tried to offer an overview of using Google Code for hosting files relevant to your own Blogger template tweaks.

I hope you've found this post useful! Please feel free to share your thoughts in the comments section below.

Komentar

Postingan populer dari blog ini

How To Add A Music Player In Blogspot

Since this archived post was written in 2007, web design and Blogger templates have changed immensely. The development of HTML5 and <audio> tags enable us to add music to our Blogspot websites and posts far more simply, and with improved control. In preparation for explaining how to podcast with Blogger, this tutorial explains how to easily add an HTML5 mp3/audio player to your blog posts or layout. No JavaScript, Flash or plugins are required, and with a fallback for older browsers which don't support the player. I've even created a simple form to generate basic tags for you! Adding music to your Blogspot site has never been so easy! Basic HTML5 Audio Tags Explained The <audio> tag is a new feature of HTML5 which we can use to natively embed audio playback in our sites. It is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari, and can be set to play the linked audio file automatically (autoplay) or loop if required. Here...

Import Blogs From Another Service To Blogger With The Google Blog Converters Project

A few months back, Blogger announced the ability to import and export Blogger hosted blogs. At the time, it was not possible to import blogs from any other service to Blogger, which left many of us a little disappointed though wondering when this service could be made available. Well it seems there is hope that Blogger can make such a service available through our Blogger dashboards soon enough! Today the the Google Blog Converters project : an open source project which aims to make available the ability to import/export feeds from many different blog platforms: This new Open Source project provides the ability to easily move blog posts and comments from service to service. This initial release provides Python libraries and runnable scripts that convert between the export formats of Blogger, LiveJournal , MovableType , and WordPress . In addition, the source code includes templates for hosting these conversions on Google App Engine . Future additions to the project will includ...

Ebooks - Updated Links

As many readers have reported, the links to download my eBooks had become corrupted during my extended hiatus. Today I have uploaded both The Blogger Template Book and The Cheats' Guide to Customizing Blogger templates to Google Documents, a relocation I hope will prove far more reliable than my previous hosting solution! I've updated the download links for these eBooks and hope everyone can now read and download these resources without any problems. It's been a long time since these eBooks were released, so here's a quick overview of both offerings for new readers and those who may have missed the documentation upon their initial releases: The Blogger Template Book Choosing and using a new template for your Blogger powered blog can be quite a daunting task. What is the best method for installation? How can you choose the design and layout most suitable for your blog? The Blogger Template Book is a free complete guide to Blogger templates, from choos...