DotNetNuke Skins and Resources by ThinkofDesign

Posted by Vasilis on Tuesday, June 30, 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.



Comments

Andrew Goldthorpe Andrew Goldthorpe says:

Hi

I am playing with a test dnn site and would like to replace the logo with the portal name.

What do I edit?
Where do I find it?
What do I use to edit it with?

Also, I would like to be able to place a 728x90 banner alongside the site name, or preferably at the top as the search box is in the way, like either of these two sites.
http://www.mirror.co.uk/news/top-stories/2009/08/02/200-at-royal-bank-of-scotland-paid-more-than-fred-goodwin-115875-21564831/
OR
http://www.timesonline.co.uk/tol/news/ (preferred method)

Please can you advise?

Sorry if these questions are really simple!

Regards, Andrew

Andy Andy says:

That's pretty neat.

Rick - PSDtoDNN Rick - PSDtoDNN says:

Vasilis,

This is a really good sample, I used to use a transparent image to create mouseover with background images, but this means I can do the same using the H1 tag, or whichever tag is used.

Only comment I have is that the H1 tag would probably be better used within the title of the page content as that would hold better with search engines.

Rick.

Oscar Oscar says:

Great idea, but I wouldn't use a H1 - because then every single page will have the same H1 tag. Bad for SEO. Instead use a neutral tag, and then each page can have its own unique H1 tag (I usually have a H1 container so the title of this module becomes the H1 tag for the page).

Casinoportal Casinoportal says:

Great idea and i would love to see it but working with Wordpress users meaning people just using it to blog who arent techies most of them dont understand the skin stuff - DNN works the same way most users get a skin installed then dont touch it on a regular basis.Its reallya smart idea..Thanks for updations..


Name (required)

Email (required)

Website

Enter the code shown above: