Under Community Review

Validate alt text before publish time

One recurring issue we've noticed is with invalid alt text. In DITA, alt text is represented as a tag <alt>. However, during publishing, this gets converted to the HTML representation of alt text, which is an alt="..." attribute. As a result, the content editors are able to enter values in the alt text in DITA that later become invalid in HTML, and there does not seem to be any mechanism in place to disallow this.

Two such examples are:

  1. Writing <i> tags within alt text in DITA. (e.g. <alt>here is a <i>sample</i> invalid alt text in DITA</alt>)
  2. Writing double quote characters inside alt text in DITA (e.g. <alt>this is "sample" alt text</alt>)
Parents
  • Hi, Damian. You make a great point, but I think this is more of a DITA issue than a Tridion Docs issue. A couple of things to consider doing: (1) If you're using the DITA Schematron, or if you're using a tool like Acrolinx, add a setting to check your <alt> tags for those invalid characters. (2) Update your DITA schema itself to disallow those characters within <alt> tags. I think (1) is easier than (2). HTH

Comment
  • Hi, Damian. You make a great point, but I think this is more of a DITA issue than a Tridion Docs issue. A couple of things to consider doing: (1) If you're using the DITA Schematron, or if you're using a tool like Acrolinx, add a setting to check your <alt> tags for those invalid characters. (2) Update your DITA schema itself to disallow those characters within <alt> tags. I think (1) is easier than (2). HTH

Children