19

I don't see there being any official way to add comments into the DWT building blocks in tridion, but i've come across a situation where i'd really like to add them without having them appear in the rendered/output html code.

I'm thinking of creating my own syntax for this and writing a tbb to strip them out during publishing.

Has anyone done this, or can suggest another method that works well for commenting?

Thanks

4 Answers 4

21

You can use <tcdl:Comment> tags - these get stripped out at request time (I think). See online docs [Login Required]

1
  • wow that's interesting, i'll give this a go
    – johnwinter
    Jul 3, 2013 at 18:43
7

You can use HTML comments:

<!-- My HTML comment -->

Then write a TBB strip them out; though no need for custom syntax unless you want to differentiate between your DWT logic comments and actual HTML comments that you want to keep.

0
6

When you say creating

your own syntax for this

... do you simply mean pre-fixing/wrapping the HTML comments with some sort of 'strip-me' identifier ... to allow some HTML comments to still push through?

<!-- this comment will make it through -->

<!-- debug:this is an internal comment and will be stripped on LIVE publishing -->

I quite like this as it's simple to use, simple to code out too and the TBB can be adapted to allow different prefixes for different comment requirements)

6

Just use an expression with an empty string and a javascript comment

${"" /*This is a comment! */}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.