Hello.

I'm using the Book module on my site. When I enable the DHTML Menu, my outline block is being fullfilled by every link item in outline. And if from user point of view, it's not critical, it's critical to the SEO, because you have all pages linked with all (but it's a bad idea in most cases, when you want to build link map as a tree). The solution of this problem is to print unexisting DHTML Menu links by Javascript.

Here's a patch for review. It may need some work, but I want to hear some feedback about the issue before.

CommentFileSizeAuthor
dhtml_menu.patch730 bytesneochief

Comments

neochief’s picture

Byt the way, it works fine for me, you may check at http://sourcemaking.com/refactoring

cburschka’s picture

Status: Needs review » Closed (won't fix)

I'm sorry, but inline script tags and document.write() are both unacceptable use of Javascript in Drupal. Any approach would need to work via extending the Drupal.behaviors object and using jQuery.

However, even if there were a solution using proper Javascript, this isn't justified. The module already uses a static class and CSS to ensure that collapsed links are not displayed, even if the user isn't using Javascript. This is done by applying the start-collapsed class to closed menus, which are hidden with the display:none rule that is respected by all search crawlers. And writing these elements via Javascript would risk a substantial cost in performance.

neochief’s picture

Status: Closed (won't fix) » Needs work

Thanks for your reply, Arancaytar.

However, I don't agree about search crawlers and display:none;. For example, we have a Yandex.ru search engine with 60% part on search market in post USSR countries. It definatelly doesn't respects invisible content like Google does.

I can write additional code, which will make this way of outputing as an option (disabled by default), but it's really critical just to have it.

As for the way this code renders the menu — yes, I know that usually things should be made through the JS behaviors, but I don't see any reason why we should move this code to behaviors, as it will only make everything slower without any benefit. Please, correct me if I wrong.

vuil’s picture

Issue summary: View changes
Status: Needs work » Closed (works as designed)