Posted by Vassilis on Wednesday, July 01, 2009
All DNN sites need a logo?
There are cases that an image for the logo can be optional like in small personal sites and blogs. By default within a DotNetNuke site we have to choose between two options, either an image or no logo at all. So today we see how to make DNN show our portal name instead of a logo image in a search engine friendly manner.
Let's first see the code example and then we explain it.
<% if len(PortalSettings.LogoFile) > 0 then %>
<dnn:logo runat="server" id="dnnLOGO" />
<% else %>
<h1 id="logo"><a href="http://<%= PortalSettings.PortalAlias.HTTPAlias %>"><%= PortalSettings.PortalName %></a></h1>
<% end if %>
What we do is pretty obvious. First we check if there is an image selected in site settings to be the logo of the portal. If there is one then we show it. That's the default DNN behavior actually. What we added is the way to handle the "else" case where a logo image has not been selected. So in that case we show an h1 and inside that a link to the portal's URL. I know that Tom will really love this! We also set the id of the h1 to be "logo" so we can customize it with CSS. And of course the text in the link is the name of our portal.
You can see that in action in the "Nucleus" skin I'm currently working on.
That's it folks. We could also update the logo skin object to do the same.
I hope you find this tip useful.
blog comments powered by