Sep
24
Written by:
Ralph Williams
Thursday, September 24, 2009 10:00 AM
Something that constantly comes up for me while working on a DotNetNuke Site as a designer, is making the site look good, being friendly toward the Search Engines and yet still keeping all of the dynamic capabilities of DNN, which is why we use it, instead of straight HTML, right? I have come across a few little tricks in which I will share in my next few posts.
One of my favorites is also very simple. It replaces the default title of a container. Doing this will remove a decent amount of the code bloat around the title, leaving it open to place directly into a header element of your choice. This also leaves it open to more easly target your title with CSS, without having other classes and elements getting in the way.
To do this, simply follow these steps:
Note: You will need to edit the ascx file. If you use the HTML method of skinning, you will need to create your skin as normal, install it and edit the ascx file that it created.
- Locate and open your container.ascx file that you wish to change.
For Example: /portals/0/containers/mydesign/container.ascx - Remove the following piece of code
- Add the following code. (I place mine at the top of the document, directly below the register tags.)
<%
Dim ModuleTitle As String = DotNetNuke.UI.Containers.Container.GetPortalModuleBase(dnnTITLE)
.ModuleConfiguration.ModuleTitle()
%> - Place this in your header tag
<%= ModuleTitle %>
such as <%= ModuleTitle %>
- Save the file back to the original location.
This technique removes the following span, which would have prevented you from wrapping your title in a compliant header tag:
I used to put the header tag in the title of the module by going to the module settings and wrapping the module title in the header tags. This is a much cleaner and automatic approach. I usually make more than one container based on which header tag I need to use. Such as, seperate h1, h2 and h3 containers. Then, I can just change my container to change the header tag.
I hope this is helpful.
Resources: How to aviod the Span in the dnn:TITLE
5 comment(s) so far...
Re: Striking a Balance between Design, SEO and DNN - Part 1
I agree you should not use the H2 inside the span, but you don't have to. What is the problem of having a span inside the h2? I mean you can use. AFAIK, the extra span should not hinder SEO?
By Timo Breumelhof on
Thursday, September 24, 2009 1:56 PM
|
Re: Striking a Balance between Design, SEO and DNN - Part 1
Ok, the module does not like the example I posted, next try:
By Timo Breumelhof on
Thursday, September 24, 2009 1:58 PM
|
Re: Striking a Balance between Design, SEO and DNN - Part 1
Grrr... try 3... ;-)
By Timo Breumelhof on
Thursday, September 24, 2009 1:59 PM
|
Re: Striking a Balance between Design, SEO and DNN - Part 1
LOL, it seems impossible to post this. So I wanted to post an the title skin obejct inside a h2 element... I hope typing h2 is allowed ;-)
By Timo Breumelhof on
Thursday, September 24, 2009 2:00 PM
|
Re: Striking a Balance between Design, SEO and DNN - Part 1
Timo,
Thank you for your comment. Granted, placing the span inside the h2 is not a BAD thing, but I try take the whole "Content separate from Design" as far as I am able. My thought is, make it as easy on the search engines as possible by reducing all of the extra code that I can. I have also found that this helps me to reduce just one more potential CSS issue as it can be tricky enough on its own.
By Ralph Williams on
Monday, September 28, 2009 5:37 PM
|