Excuse my lack of expertise on the topic but how does Discourse handle the clicking of the hamburger menu link?
Context: I’m using the prerender.io service to serve an HTML version of the main (JS version of the site)
The menu hamburger link doesn’t work.
You can test ( the site ) by using the chrome dev tools and changing the agent to Googlebot smartphone. When using the googlebot user agent you’re in effect getting the HTML prerender version.
Side Note: According to this blog post from prerender , it could have issues with code like
All links need to be between tags and define a target URL within the href attribute for Google to be able to find and follow it.
Perhaps the main menu link is generated using this method?
Any ideas on a solution would be very much appreciated.
Edit I took the site off prerender for now ( but keeping JS version served to bots ) - Surprisingly google bot seems to render it correctly once in a while. I also have no menu issues when using the google bot as the user agent in chrome. Im going to test this for a little bit.
The menu is appended to the document with Javascript when the button is clicked, so it won’t easily be converted to work on an HTML-only version of the site.
Here’s where the button is added, you can see it has an action named toggleHamburger:
The toggleHamburger action is defined later in the same file, here:
toggleHamburger changes the hamburgerVisible state, so the menu is ultimately added with panels.push(this.attach("hamburger-menu")); which you can see here:
Quality response @awesomerobot , I’m sure the community appreciates it.
I will look this over to see if custom work is worth it.
The response I got from prerender.io was basically if it uses “complicated JS” it probably wont work. Not sure how well they studied the situation though.