MODX revo – if statements / testing if a tv is empty or not

In my MODX “elements”, i have a TV, witch i use for define a canonical link.

That link must exist only if the tv’s is compiled. So, i want to check if is it.

MODX, give us a method for  testing it.

Let’s go and see it in action.

I ‘have a TV called “Canonical”, in witch, when i need it, i write the link for pointing the canonical to the right resource.

in my template file i add :


<!-- Check for canonical -->
[[*canonical:notempty=`<link rel="canonical" href="[[*canonical]]">`]]
<!-- End Check for canonical -->


“canonical” is the name of my tv’s., and “notempty” is the “Modifier”.

Here you can find full – Input and Output Filters (Output Modifiers) – for modx