| 0 comments ]

The old Blogger templates didn't have fancy drag-and-drop widgets, but it felt like they had more control with the special <$Blogger...$> tags. That is until I truly started to understand the new template structure. Now you can create templates which allow for drag-and-drop while showing/hiding pieces of code or widgets themselves on specific pages. For this post, I wanted to show you some useful things I've found out how to do.

Let me explain I'm going to be working with the raw HTML on the Template tab under Edit HTML. Please do us a favor and backup your current template HTML by copying it into NotePad/TextPad. Additionally, remember to check the box labeled Expand Widget Templates otherwise Blogger hides the tags we'll be modifying. And finally, don't worry too much about messing things up. The blog's data is not being modified, neither are the URL's, and you can always revert your template by pasting your backup into the template HTML textarea.
neither are the URL's, and you can always revert your template by pasting your backup into the template HTML textarea.

Blogger: Template: Edit HTML

Prevent Archive Page Indexing


Using a clever robots meta tag and Blogger's conditional layout tags you can prevent search engines from indexing archive pages, but still let spiders find and follow links within them. Archive pages can be useful to users who want to browse your site, but they're terrible to arrive at from Google or another search engine. The problem is they can get intimidatingly large and are confusing to visitors unsure of exactly what post/wording to look for.

Place your meta tags immediatley after <b:include data='blog' name='all-head-content'/> or <head> in your template.

Don't index any archive page:

<b:if cond='data:blog.pageType == "archive"'>

<meta

content='noindex,follow' name='robots'/>

</b:if>

Prevent archiving main page and all archive pages:

<b:if cond='data:blog.pageType == "archive"'>

<meta

content='noindex,follow' name='robots'/>

</b:if>

<b:if

cond='data:blog.pageType == "index"'>

<b:if cond='data:blog.url !=

data:blog.homepageUrl'>

<meta content='noindex,follow' name='robots'/>

</b:if>

</b:if>

That one uses a nested if. It's more complicated because Blogger considers both the main page and label pages as "index" pages; there are three page types: index, post, and archive.

If you want to prevent indexing on everything except individual post pages:

<b:if cond='data:blog.pageType != "post"'>

<meta

content='noindex,follow' name='robots'/>

</b:if>


Even though I said there's no danger in messing with your template, screwing up your robots tag is a bad problem. Make sure you view the HTML on the output of your blog to ensure that it's not putting this on all pages; check and double-check. If Google is told not to index a page, then it may not revisit that URL for indexing - ever. You can't be sure and it's a pain to fix indexing problems. That is, it's easy to get removed from the index, but difficult to get put back in!

Show on Main Page Only

Many sites have splash text, a table of contents, or something else that is only shown on the front page of their site. This allows new users to become familiar with the layout and goal without being inundated with brand-spanking-new posts about who knows what.

Adding front-page-only content is slightly complicated and error-prone, so put on your rubber gloves and let's dive in. What you'll need to do is make it so your main pane can have widgets added to it, add an HTML/JavaScript widget, and then modify it so it only shows up on the main index page. All conditional layout affects widgets in Blogger's new template system, so you can't simply hard-code some content and have it conditionally shown or hidden.

1. Allow Widgets in Posts Area:
Find the "main" section in your template code, it will probably have an attribute that says showaddelement='no'. That's part of the reason why you can't add new page elements to the main post area. The other is it needs a new attribute called maxwidgets which should be greater than one. So, change that whole tag to the following:

<b:section class='main' id='main' showaddelement='yes' maxwidgets='2'>

Save the template.

2. Add a HTML/JavaScript Widget:

Enter the Page Template GUI, the main area should now have the familiar "Add Page Element" above the "Posts" section. Click it, pick the HTML/JavaScript, and type in whatever text you want to see on the front page.

3. Modify Widget to Only Appear on Main Page:

Head back into the template code and find your new widget, make sure "Expand Widget Templates" is checked! Add the following immediately after <b:includable id='main'>:

<b:if

cond='data:blog.pageType == "index"'> <b:if cond='data:blog.url ==

data:blog.homepageUrl'>

Insert the ends immediately before </b:includable>:

</b:if></b:if>

Save your template and view the site!

Now you can modify the widget's data through Blogger's nifty GUI and never have to touch the template code again ... or at least that's the theory.

References:

0 comments

Post a Comment

Thanks for reading , if you have any problem please leave me a comment here I will help you by my best.Please note that you put the friendly words to help each other to improving and developing these tips to be better,or the best way for you to track my blog is subscribing my Feed.You are always welcome on http://bloghelpforbegineers.blogspot.com

Best regards,
-Amaresh