Langsung ke konten utama

How To Add A Featured Content Section On Your Blog's Home Page

One of the customizations I use most when designing Blogger templates is creating a "featured content" section to be displayed only on the home page. I often use this technique to display a content slider, mini-portfolio or slideshow above the main posts section.

Take a look at the home page of my site, Just Great Film, to see an example of this in action (click on images for full screen previews):

Here's an easy way to restrict the display of a gadget to your blog's home page.



Back-up your existing template

Before making any changes to the HTML code of your Blogger template, it's advisable to make a backup of your existing, working template code, just in case you make a mistake when editing or accidentally save unwanted changes!

To make a back-up of your Blogger template, simply go to Layout>Edit HTML in your Blogger dashboard and click the "Download full template" link near the top of the page.

This will prompt you to save your existing template file as an .XML document to your computer, which you could later upload if you need to restore your theme.

About "Conditional" Tags

"Conditional" template tags enable us to dictate the type of page in which the enclosed content can be displayed.

In this example, we are restricting the display to the home page only, and will be using the following syntax:

<b:if cond='"data:blog.url==data:blog.homepageUrl"'>
<--Content to be displayed on home page appears here -->
</b:if>

Anything which appears between the <b:if> tags will be displayed only on the home page. We can add any HTML content between these tags, including Blogger template tags.

If you're confident editing the template code of your blog, you can adapt the code snippet to suit your requirements. Or read on for the simplest way to add this function to your template.


The simplest way to add a featured content section on your blog's home page

If you're using Blogger's new template editor (the new format for Blogger templates) you can add a featured content section in a few simple steps:
  1. Go to Layout>Edit HTML and locate the following section of code:
    <div class='region-inner tabs-inner'>
    <b:section class='tabs' id='crosscol' maxwidgets='1' showaddelement='yes'>
    <b:widget id='Text2' locked='false' title='Some Title' type='Text'/>
    </b:section>
    <b:section class='tabs' id='crosscol-overflow' showaddelement='no'/>
    </div>

    Depending on whether you have installed a Page Links (or other) gadget, you may also see other gadgets housed within this section
  2. Add the following lines (highlighted in red) to this section of your template code:
    <div class='region-inner tabs-inner'>
    <b:section class='tabs' id='crosscol' maxwidgets='1' showaddelement='yes'>
    <b:widget id='Text2' locked='false' title='Some Title' type='Text'/>
    </b:section>
    <b:section class='tabs' id='crosscol-overflow' showaddelement='no'/>
    <b:if cond='data:blog.url == data:blog.homepageUrl'>
    <b:section class='tabs' id='crosscol-homepage' showaddelement='yes'>
    <b:widget id='HTML1' locked='false' title='Add title if you want to' type='HTML'/>
    </b:section>
    </b:if>
    </div>

    This will add an additional gadget section (beneath your tabbed page navigation, if present) in which you can add home-page-only content via the Page Elements section of your dashboard.

    I've added a placeholder gadget in this code so you can easily identify the section when editing your gadgets in the Page Elements section of your dashboard.
  3. Now preview your template: if all goes well, you should see your gadget appear in place above the posts without error and can proceed to save your template.
In order to add a gadget which only appears on the home page, go to Layout>Page Elements and edit the gadget titled "Home Page Gadget" which will appear above your blog posts. Alternatively, delete this gadget and add a new gadget as per your own requirements.


Did you find this tutorial useful?

I hope that this tutorial has explained how you can add a section to your template which will only appear on your blog's home page. Please let me know your opinions by leaving your comments 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

Download Mp3 - blackpink is suffering

download lagu 123 blackpink is suffering - download lagu terbaru Iconic Blackpink Rose moments- free download lagu mp3 Iconic Blackpink Rose moments- download lagu mp3 full Blackpink-download lagu 123 MP3 chaotic blackpink moments that i can&#;t forget, Semua Lagu-Lagu, Video dan Lyrics tersedia disini, Semua Musik ini berasal dari Youtube.com dan gratis untuk didownload. Belilah Lagu blackpink is suffering dan kasetnya di Toko Terdekat Maupun di iTunes atau Amazon secara legal, ini hanya sebagai Review dan Promosi saja. Video Terkait Video Download MP3 blackpink is suffering Download MP3 Iconic Blackpink Rose moments Download MP3 Iconic Blackpink Rose moments Download MP3 Blackpink Download MP3 chaotic blackpink moments that i can&#;t forget download lagu 123 blackpink is suffering - download lagu terbaru Iconic Blackpink Rose moments- free download lagu mp3 Iconic Blackpink Rose moments- download lagu mp3 full Blackpink-download lagu 123 MP3 chaotic blackpink moments