Tuesday, August 13, 2013

How To: Set Up Different Header Images on Blogger Pages

(These instructions were originally developed to go with the Anderson Language & Technology Center Language Refresher Courses templates. The Refresher Course template is available upon request.)

About the header images

The header images used for the refresher pages are a combination of the default header image (That is, the image you upload through the Layout editor in the blog settings) and static images which are brought in only on specific pages.
To set up the header images, first locate the section of the template which begins with the following lines of code:
      <!--Show the image only-->
      <div id='header-inner'>
        <a expr:href='data:blog.homepageUrl' style='display: block'>
The format for customizing which image displays is as follows. Change this code, and then paste it into the aforementioned section of the template xml.

To swap out the header images on specific pages:

Include the following in your blogger template:

<b:if cond='data:blog.url == "[SPECIFIC PAGE URL]"'>
    <img expr:alt='data:title' expr:height='data:height' expr:id='&quot;_headerimg&quot;' src='[IMAGE URL]' style='display: block'/>
  </b:if>

Where [SPECIFIC PAGE URL] is the FULL url of the page in question, and [IMAGE URL] is the location of the new header image you wish to use. Custom image on the “About” page:
<b:if cond='data:blog.url == &quot;http://germanrefresher.blogspot.com/p/about.html&quot;'>
    <img expr:alt='data:title' expr:height='data:height' expr:id='&quot;_headerimg&quot;' src='http://altec.colorado.edu/refresher_items/banners/gweek1.jpg' style='display: block'/>
  </b:if>

To use the default image on a page, use the following format instead:

<b:if cond='data:blog.url == "[SPECIFIC PAGE URL]"'>
    <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + &quot;_headerimg&quot;' expr:src='data:sourceUrl' expr:width='data:width' style='display: block'/>
  </b:if>

This will pull in whichever image you uploaded through the blogger Layout editor. For a default image on the homepage:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
  <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + &quot;_headerimg&quot;' expr:src='data:sourceUrl' expr:width='data:width' style='display: block'/>

</b:if>

11 comments:

  1. I simply wish to give an enormous thumbs up for the great data you've gotten here on this post. I will likely be coming again to your weblog for more soon.
    website design

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Hello Isla,

    Could you please take a look at my Blog and tell me how to make my idea work.
    http://shredair.blogspot.com/

    I want to have a menu bar with links that group my posts (Andes, Colombia, NW). Each group with a different header image. Andes does not have any posts yet.

    First, I put the posts of my Blogspot blog into Pages and created the menu bar with the Pages gadget (http://blogger-hints-and-tips.blogspot.com/2010/12/how-to-put-put-posts-into-your-pages-in.html).   
    This part is working.

    Then, I followed your instructions on How To: Set Up Different Header Images on Blogger Pages by including the code three times (for each label and header image) in the template below “show the image only after the closing /a”

    Page url and image
    "http://shredair.blogspot.com/search/label/Andes"
    http://shredair.com/2015south/titleAN.jpg
    http://shredair.blogspot.com/search/label/Colombia
    http://shredair.com/2015south/titleCO.jpg
    http://shredair.blogspot.com/search/label/Northwest
    http://shredair.com/2015south/titleNW.jpg

    The images are not changing. Is this a correct use of your instructions?

    I appreciate any help you could give me.

    Thank you,

    Marcela

    ReplyDelete
    Replies
    1. Hi there,

      Apologies for the inconvenience, but from what I can see of the pages gadget and the current setup of your site, there may be an incompatibility. At the moment, I would recommend asking the writers of blogger-hints-and-tips if they know a workaround or a way to do this with the pages gadget, as I suspect this method may not be of much help if you are using that one for grouping your posts.

      Again, I apologies for the inconvenience.

      Delete
    2. Hello Isla,

      I appreciate your prompt reply. Is there any other way you would recommend to group the posts and display a different image in each section?

      Thank you very much.

      Marcela

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. For me it's displaying both headers? http://www.remasteredmedia.co.uk/2015/04/down-with-downfish.html

    ReplyDelete
  7. Could you please take a look at my Blog and tell me how to make my idea work.
    http://michezon.blogspot.com/

    ReplyDelete
  8. I'm on the fence about this, while more customization is good, I have a feeling this is a "in-progress" update, it just feels incomplete and half-way there.
    We use badge layout for apps on design approvals (visual projects), so the image being displayed is important. Old layout "feels like" it had larger images,
    maybe because the images were cropped more loosely so it's easier to tell which project it was at quick glance. Now the image is cropped closer, making it
    harder to scan thru at quick glance. I find myself needing to click into the project more often than usual. Which makes the whole user experience less
    efficient.
    I have a couple suggestions that might make it work better:
    1. Increase the height of the window the cover image is being displayed.
    2. Let us to choose which image to be displayed as "cover" (like how Pinterest handles cover images of each board, was hoping for this for a long time)
    3. Let us adjust which part of the image to show and how tight or loose the crop is (with a fixed window, let us move the image around and maybe enlarge or
    shrink it to control what shows thru the window. Pinterest does a limited form of this, which is very useful in making the cover image relevant)
    4. Allow Cover Image to be ordered in different hierarchy (currently every element can be ordered differently except the Cover Image, it seems to be stuck
    in the 2nd spot, would like the option to set it on another spot in the layout. This one seems like an easy fix, since you guys allow that for every other
    element already)

    ReplyDelete