Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
Welcome to AspAdvice Sign in | Join | Help

Hiding Home "Link" on Home Page

  •  09-19-2007, 7:47 AM

    Hiding Home "Link" on Home Page

    Vine Type navigation links, by design, follow a best practice that is not practiced on the vast majority of websites: Don't Link To The Page You're On.

    We've all seen this before.  Some set of standard links to every page is displayed across the top of every web page -- so there's always a link that can be clicked that leads you back to the page you are already on.  Vine Type navigation by default shows all the section names, but after clicking a section link, it is no longer clickable and can be styled differently to indicate that you are in that section.  See, for example: Brad Shields

    But what if you want to hide the home "link" (it's not a link on the home page of course) altogether?  Vine Type allows this to be done as you can see at this site: Bill Flood

    It takes a bit of CSS trickery to accomplish.  Just two easy steps actually.

    First, in your template file (that's the one that ends in .html in your vinetype folder) alter the <body> tag to include a class name of the navigation section.

    <body class="$_nav_section">

    When Vine Type generates the XHTML for the page, it will put the section heading into the class attribute. If your home page is called "home" then your class attribute will be "home" on the home page.  Great. Now we can use CSS to hide the home "link" (it's not a link) list element on the home page only.  In your CSS file add this line:

    body.home ul.section #nav_home
    {
       display:none;
    }

    This will "delete" the home "link" (it's not a link) list element from the navigation section list.  And, if CSS is disabled, it reappears and is still not a link.

     

    OOPS Full disclosure here.  The Brad Shields site has a link on the home page to the home page!  The Vine Type-generated navigation is following the best practice rule, but I added little icon links to the right of the masthead --  so those two pages link to themselves.  Nobody's perfect I suppose.  :-)

     


    Sincerely,

    Carl
    -----
    vine type - content management with standards in mind - vinetype.com
    -----
    Filed under: ,
View Complete Thread