Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Thursday, November 11, 2010

Restricting Blogger links to the home page

For those of you who have sites on Blogger, one of the great advantages is that you don't have to know HTML or any other programming language to have a site up and running in minutes. While you can use Blogger-supplied code (called gadgets) to add or subtract extra content into a sidebar like blogrolls, polls, or a search box, you don't usually have any options when it comes to where those widgets will be seen. Typically, once a Blogger gadget is added, you will see the content of that Gadget
in the sidebar of every page on the site.

If you have a handful of links that you only want on the home page, one option is to use the HTML/Javascript gadget (my favorite for adding plain text links) and to change how that gadget operates so that it only shows up on the home page. This involves changing the template that controls the look and feel of the site. By adding a couple of lines of code, you can change this gadget so that it is only visible on the home page.


Note:If you haven't done any kind of web site or blog coding before using HTML, and feel unsure about changing the code, either find someone who can do it for you or practice this on either one of your inactive Blogger sites or on a site that you put together for testing changes like this.


The following instructions are taking from an article on the Blogger Tricks site:
  • Sign into Blogger dashboard and click on the Design link for your blog, click on the Add a Gadget on your blog's layout, and then select the type of gadget you need (for example HTML/Javascript). Add the content that you want, and save your changes.

  • Next, you have to add a small piece of code to that gadget so that your content only displays in the Homepage. Just clcik to Edit HTML and then select the box next to 'Expand Widget Templates'. Now would also be a good time to save the template just in case.

  • Find the HTML/Javascript gadget, which should start with code that looks like <b:widget id='HTML1' locked='false' title='' type='HTML>

  • Just below that line of code, You should see a "b:includable" tag that looks like <b:includable id='main'>

  • Under that line, add the following: <b:if cond='data:blog.url == data:blog.homepageUrl'>

  • Just before the line </b:includable> tag, add the line </b:if> to close the "if" statement.

  • Save your template and test your blog. If everything went well, you should only see that gadget on the home page.
The same Blogger Tricks article also shows you how to do this for other types of gadgets, and also how to do this so that the gadget content shows up everywhere except the home page.

Tuesday, October 13, 2009

Easy to Use Encoder That Allows You to Properly Format Source Code For Inclusion in a Web Site or Blog

Sometimes using the right search terms can uncover the right tool at the right time. The other day, I was writing a post for another blog and I needed to put raw source code in the post. Blogger will try to execute the code no matter what kind of formatting tags I put around it. I wanted readers to be able to easily copy and paste the code, so making it into a graphic wasn't a good choice.

After about 30 seconds searching for an answer of how to put raw code into a blog without it getting executed, I ran into an online converter that did the job for me. It did things that would have been very time consuming if I had to do it by hand, things like changing '<' to '<. and similar conversions for '>', '&', and '"'.

Resources
For this and other links to search engine optimization and web site development tools, visit AirSafe Media's Delicious links at delicious.com/airsafe.