I am using the latest Lightbox2 module for Drupal which works great but for my field images it adds a rel="lightbox[field_image][]" which fails W3C validation.

Is there a way to work around this so it passes validation? I have been reading somewhere to change the "rel" to "data-rel", but how would you apply this? Any ideas?

1 Answer 1


You can copy the lightbox2-insert-image.tpl.php file into your own theme and change it there - but this will break the functionality of the module as javascript uses rel attribute multiple times.

You could refactor the javascript, change all occurrences where it accesses rel and change it to data-rel and create patch and submit it to drupal.org to the author of the issue as a request (or just submit issue now requesting this and wait if/until the maintainer does it).

On a personal note - why do you need it to pass W3C validation? Is it a project MUST requirement? If not, I would not waste any time on this as valid HTML is not that important any more, not even for SEO and indexing.

Edit: http://google.com is not passing W3C validation, I think that sends a message. (http://validator.w3.org/check?uri=google.com&charset=%28detect+automatically%29&doctype=Inline&group=0)

Your Answer

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

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