I use JavaScript in the body of a node with some PHP code. After I run cron.php and search on the site, I can see Drupal indexes the JavaScript code contained in a node.

How do I avoid Drupal indexes the JavaScript code?
Alternatively, how do I avoid Drupal indexes those nodes?

1 Answer 1


Since the javascript code is actually part of the node content it would take a bit of work to get it to be ignored.

An easier solution would be to use implement hook_db_rewrite_sql() and excludes from appearing in search results. Here is a great tutorial: Hiding content from Drupal's search system.

That said, there is a module out there that does this, Search Config. However it is marked as obsolete and not being maintained anymore, therefore you might want to think twice before using it.

For the record it does indeed work as designed, and works well! (I use it on my website with no problems).

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.