How to Tell if the Page Is the Home Page

Topics: Themes
Aug 22, 2010 at 2:59 PM

I'm working on creating a theme where certain items will only be displayed on the "home" page.  What is the best way to do this?  My current thought is to put runat="server" and hide them in the Page_Load event within site.master.cs.  Alternatively, I could use placeholders and actually put the content in the places if it's the home page.  Either way, though, I'm struggling on the if statement that will tell me if the user is viewing the home page.


Aug 23, 2010 at 9:09 AM

To determine if you're on the homepage, see the last post by me on Jan 14 2009 post in this thread.

Wrapping the content in placeholders, and setting the Visible property sounds like a good idea.

Aug 23, 2010 at 1:18 PM

Thanks - works like a charm!  Also, Visible is the route I went; through testing last night, I discovered that it doesn't even render it when that's set to false, which is exactly what I want.  :)