Mobile app version of vmapp.org
Login or Join
Jennifer507

: Duplication of menu through javascript or PHP: Which is better for SEO and page performance? I have a site with a typical desktop dropdown menu. For the mobile menu (and on touch devices),

@Jennifer507

Posted in: #Javascript #Performance #Php #Seo

I have a site with a typical desktop dropdown menu. For the mobile menu (and on touch devices), I am using javascript to slide it out onto the page from the right side by touching a menu button.

The issue is that I am using javascript to duplicate the desktop menu and populate it into the hidden side div. Is this a bad idea? I don't see much of a performance drop (only like 50ms or so when I disable JS), but could this cause issues on slower computers?

Or would it be better to duplicate the menu into the side div through PHP so it's directly in the source code? Doing this will probably be faster, but will it have an impact on my SEO by displaying the navigation twice to search engines?

Looking at searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157, it seems like it's already being crawled twice, so I should think about my visitors overall experience and duplicate it without the use of javascript.

What is the best practice when dealing with the same menu multiple times on the page?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sue5673885

The very perfect way would be to let your one menu compatible for both cases by using different CSS for different resolutions using the @media queries. The big advantage is that you don't care what device is visiting your website, you simply change the layout on the fly depending how much width the browser has.

Having duplicated content in your website is not good and as you see, Google can even parse your JavaScript and get it. (I was just surprised, thanks for showing me that.) If you decide to use PHP to display one of your two menus, it will not be very responsive, i.e. you cannot switch the menu when the width changes as you could with the @media queries.

For instance, I visit your website with my tablet in portrait mode and you show the collapsed menu. Once I go to landscape I would like to see the desktop version, as my resolution might fit for that and it would be more comfortable. But it won't when having two menus.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme