Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side pre-rendering for SEO #525

Closed
courtneyaschwartz opened this issue Jun 4, 2018 · 4 comments
Closed

Server-side pre-rendering for SEO #525

courtneyaschwartz opened this issue Jun 4, 2018 · 4 comments
Labels

Comments

@courtneyaschwartz
Copy link

courtneyaschwartz commented Jun 4, 2018

This might be just a question/docs tweak.

(Can't tell if the feature I need exists or not...)

I found these promising bits in Readme.md:

  • Features: "redoc-cli with ability to bundle your docs into zero-dependency HTML file"
  • Roadmap: "docs pre-rendering (performance and SEO)" crossed out

And:

But...

ReDoc's client-side JavaScript rendered docs work well. We're using that for most clients.

But like #124, sometimes server-side static HTML is needed for PDF engines and SEO. If the client is a search engine/print app that doesn't run JavaScript (or not extensively enough) and therefore cannot search index or print JavaScript-rendered docs, then I need to return static HTML instead.

Does ReDoc CLI do this?

@RomanHotsiy
Copy link
Member

redoc-cli says "starts the server" but not much else

use redoc-cli's bundle command instead of serve which

bundles spec and ReDoc into zero-dependency HTML file

@courtneyaschwartz
Copy link
Author

@RomanGotsiy Sorry, but that doesn't yield a yes/no answer... That's why I had to ask.

"Zero-dependency HTML file" is a sexy sound bite, but ambiguous.

For example, it could mean one HTML file with embedded ReDoc. That would not be what I need. Or it could mean static HTML, no JavaScript. Or no node.js dependencies. I can't tell. I need something less marketing-ish and more tech doc-ish about the feature's intended behaviour.

So... "Yes, bundles will be static HTML+CSS only (no JS)"? Or "No, bundles will still require a JS engine to render the page"?

@RomanHotsiy
Copy link
Member

ok, so "Zero-dependency HTML file" - server-side rendered ReDoc with embedded ReDoc.

So all the initial HTML + CSS are in the HTML and can be rendered by the browser immediately. But it is not interactive. That's why bundle contains ReDoc embedded js which hydrates the view and makes it interactive.

You can use ReDoc from the CDN instead of embedding it into the page by passing --cdn option to bundle command.

It works exactly same as any Server Side rendered React application so look there for more detailed information.

Practically, it means you can deploy resulting HTML to any static hosting or just send it via email and user will be able to just double-click your file to see it.

Hope this answer is more useful!

@courtneyaschwartz
Copy link
Author

Perfect. That's what I needed to know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants