איך discourse יוצר תגיות html ידידותיות ל-SEO כאשר האתר כתוב ב-Emberjs?

סיכום מבוסס בינה מלאכותית

In a discussion about how Discourse generates SEO-friendly HTML despite being built with Ember.js, rubydoob asks how static HTML is produced for crawlers. pfaffman explains that Discourse sends static HTML to crawlers, and sam clarifies this happens at the Rails layer via traditional rendering on key pages. rubydoob seeks specifics on where this is configured — Rails or Nginx — and pfaffman points to the application_controller for logic involving “crawler” detection, and suggests examining the StaticController for bypassing Ember entirely. He also recommends disabling JavaScript in the browser to observe the static output. rubydoob clarifies they’re simply curious about the implementation, not troubleshooting an issue. The consensus is that SEO-friendly HTML is rendered server-side in Rails, primarily through StaticController and crawler-detection logic in application_controller, ensuring search engines receive fully rendered content without relying on client-side Ember.

Looking at the generated HTML I can see regular <div> tags for a forum thread along with its content in the HTML, looking like a regular html template.

How does discourse generate this search engine friendly html when it is written in emberjs?

It sends static html to crawlers

where is that setting? in rails or nginx?

In rails, we do a traditional render on key pages

where is this done, at the nginx layer or rails layer? link to source please?

It’s in rails. I don’t quite understand how it works, but you can look in the application_controller for “crawler”. That appears to be where some of the magic happens.

I just spent a day figuring out that my plugin needs to use the StaticController when it does a render plain:.

So maybe you want to look at the static_controller. That appears to be how to bypass Ember, so maybe that’s what you want to see.

You can disable javascript in your browser and see what it renders.

But maybe you want to say what problem you are trying to solve rather than talk about your solution.

Just want to learn how its done, don’t actually have any issue I am trying to solve. Thanks!