Thursday, March 25, 2010

Making a Gadget that looks like a Post

This article is about how to make a gadget display (almost) all the things you can put into a post in Blogger.

Summary:

Previously, I've described how a gadget that only appears on the first screen is one option for giving your blog a home page.

One apparent weaknesses with a gadget is that it can only contain one type of "thing" - text, or a picture, or a poll or - or whatever other type of gadget you choose.

But - an HTML/Javascript gadget can contain almost any valid HTML.   And each post is really just made up of HTML.   So:

You can make a gadget look like the body of a post by 
copying the HTML from a post, and pasting it into the gadget!
 
The picture below is an example of what such a gadget looks like.  I've given it a title ("Test Gadget"), though for a real blog, I probably wouldn't bother.   Notice that unlike the Post after it, the gadget doesn't have an author, date, comments or an edit-this link

See further down in the article for detailed instructions, and also for notes about which features from Posts will not show up within your gadget.




Follow these steps to make a gadget look like a Post

1  Create a new post  (you won't be saving this,  you are simply using it to get the HTML)


2  Edit it in the usual way, until it is complete and ready to publish - but don't publish it.

3  Click on the Edit HTML tab at the top-right-side of the Post-editor (old interface) or the HTML tab at the top-left-side (new interface)


4  Put your cursor into the editing window, and select ALL the code that is shown.   (Ctrl / A does this in many systems)


Copy the HTML


6  Press Save Draft or Save Now   (not Publish Post)


Add an HTML gadget to your blog in the usual way


Paste the the HTML that you just copied into the Content field.


Save the gadget, and drag it to wherever you want it.


10  Once you're happy with the gadget, go back to Posting > Edit Posts, and delete the post that you used to make the gadget.   (This step is options, but it will stop you accidentally publishing the post later on.)


Post features that don't work in Gadgets:

Of course there are some features of Posts that don't work in gadgets:

Don't put anything into the title field - it's not part of the HTML for the post, so won't be displayed.   Instead, type in any title you want, and format it yourself.   (Search engines won't index contents from your welcome gadget very because of this - so make sure that the content is elsewhere in your blog too.)

Jump-breaks don't work:  you can put them into the post, but they have little or no effect on how the gadget looks.

Labels.  Gadgets don't have them, so don't bother.   (except if you want to keep the "construction" page around as a draft:  I often label things like with as "Site Admin" or similar)

Backing up.  Gadgets aren't included when you export a copy of your blog.   Gadget contents may not always be backed up when you export your template (I haven't tested recently) - actually, this is a good reason to keep the "construction post" around as a draft.



Related Articles: 



A gadget that only appears on the first screen is one option for giving your blog a home page.

Giving your Blog a Home Page

Share this Article

URL:

HTML link code:

BB (forum) link code:

Subscribe to Blogger-hints-and-tips

FeedBurner will send a confirmation message. Click the verify link in it to start your subscription.

Follow Me on Pinterest Subscribe to Blogger-HAT on Google + RSS subscription icon Follow BloggerHAT on Twitter

4 comments:

  1. thanks for the tips, so if I use a html/javascript widget and create a homepage using that, isn't google going to index that page, then really the page becomes useless.
    Is there a method to make the widget indexed by google.

    Thanks!!

    ReplyDelete
  2. Nice! but how do i display it only on the home page and not on the other page?

    ReplyDelete
    Replies
    1. See here:
      http://blogger-hints-and-tips.blogspot.com/2010/03/displaying-gadget-only-on-home-page.html

      Delete