Personal tools
You are here: Home weblog Tridion behaves badly when publishing ASPX

Tridion behaves badly when publishing ASPX

Posted by Dominic Cronin at Jan 12, 2006 01:00 AM |
Filed under: ,

Tridion behaves badly when publishing ASPX

When you publish ASP.NET code from Tridion using the TCDL mechanism, it adds extra output that you didn't ask for. Specifically, each component presentation is emitted wrapped in a span tag. The span tag has an ID composed of the URI's of the component and component template.

These span tags aren't there because you asked for them in your content, or in your templates, so why are they there?

I reported this bug to Tridion customer support, and they told me that it's not a bug. It's designed that way, they say. Fair enough, I say, then it's a design bug. Apparently, the purpose is "to make it easier for SiteEdit and template designers to manipulate existing component presentations. Well that won't wash, because it's no earthly use for either purpose.

Is it a bug? Walks like a duck, quacks like a duck....

What harm can it do?

  • Well in my case the main issue was that in XHTML a span tag isn't allowed to contain block-level elements. That means the XHTML produced this way is invalid. (I'm the kind of guy that likes to see a clean compile, and I like to see my web pages validate correctly too. This isn't just bravado, it's the most efficient way to work.)
  • On top of that, you might not always be in charge of the CSS on your site. What if someone specifies a child selector instead of a descendant? That's just an example: you can imagine a hundred other ways this detritus could ruin your style.
  • Oh heck! It's just broken, that's all. A web content management system should allow you to manage your web content. That means not emitting things you didn't ask for.

Anyway - what can you do about it?

  • You can ignore it. This might be OK if you don't care about validation, and you have complete control of the styles.
  • Of the people I've spoken to, it seems most are simply avoiding the problem by publishing to a Publishing Target with Target Language set to None. Of course, if you do this, you have to writeOut the various functions for linking etc. yourself. If everyone does this, then Tridion might as well never have invented TCDL in the first place.
  • You can create a customised version of the AspDotNETTransformer. This is probably what I'll do. Tridion customer support have provided me with some java source code (which is just as well as it's an undocumented API). It looks straightforward enough and it's install once - fixed forever.
Quack, Quack!!!
Document Actions

Span's in Tridion are the Devil!

Avatar Posted by Paul Welsh at Jan 22, 2010 09:50 PM
As a frontend developer at a Tridion partner company, i feel your pain! When i write my code, i make sure it validates and it is as clean as possible before i pass it on to the developers.... all should be smooth sailing after that. BUT NO, i'll get a tap saying 'erm, the site looks wrong' or 'the javascript isn't working'... 9/10 its the bloody span tags causing layout/functionality issues (mainly in Internet Explorer... which is ALWAYS the clients test browser).

obviously this issues disappear when the site is published to 'live' when the span tags are removed... but if the site is not working correctly on the 'staging' enviroment, then its never going to go live!

I am sure there should be some way to manipulate existing component presentations this way, possibly use a 'div' tag with 'display:inline' applied to it (though this wouldn't fix the child/parent selector issues)

any ways, i've had my rant and i feel better now! haha

Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
Tell us your name.
(Required)
Enter your e-mail address.
(Required)
(Required)