[feature request] Server-side rendering
Will be great for fast page load and SEO
+1
+1
+1
+1
there is a whole bunch of services out there that can take care of SEO problem with very little hassle. Quick google search reveals a bunch of them. I'm not familiar with any of them so I'm not going to share any names in order not to make an impression of an endorsement.
if you want to run your own setup (which sounds like you are since you want server-side prerendering) then check out this yearofmoo article http://www.yearofmoo.com/2012/11/angularjs-and-seo.html
dupe of #2104
Thank you! Although I use one of such solutions (custom with zombiejs) I can't call it good solution.. It has many disabilities and all of them are summarized in fact that we need pay time for supporting this render separatelly. And with real render this can be achieved automatically.
some of disabilities:
- each rendered page individually should declare the time when it's finished rendering
- rendered page is not exactly the same as browser version. (even phantomjs, which doesn't support es5)
- it is very slow
- it is only for SEO
Maybe instead of server-side rendering, we could specify default content in Angular somehow? Perhaps if JS is disabled, or the page is slow (and assuming you aren't using ng-cloak to hide the raw templates), default content could be shown. ¯\_(ツ)_/¯
I think the browser already lets you add content for when JS is disabled, using the <noscript> tag.
Actually, there is a better way. If you use a directive, it will only work if JS is enabled. So, if you wrap the noscript content in a directive, it will appear if JS is disabled.
Example: This is the both pre-rendered markup, and markup that appears if JS is turned off. The browser will just ignore the attribute, and render the div normally.
<div data-context-selector>
<select>
<option value="Any app">Any app</option>
<option value="Blog Engine">Blog Engine</option>
<option value="Ruby Gem Search">Ruby Gem Search</option>
<option value="Project Manager">Project Manager</option>
</select>
</div>
appDirectives.directive("contextSelector", function() {
return {
templateUrl: '/views/components/context-selector.html',
replace: true
}
});
If JS is enabled, the noscript content is replaced with your directive.
<div class="context-selector">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{getAppName(selectedApp)}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" ng-model="app">
<li ng-repeat="app in catalog.apps" ng-click="selectApp(app)">{{getAppName(app)}} - {{getAppRuntime(app)}}</li>
</ul>
</div>
@kevinSuttle & @IgorMinar - Is the discussion for server side rendering going to continue on #2104 or this thread? It would be nice to have a centralized forum for discussion as this is an issue thats not only pertinent to SEO but also is useful for heavily-trafficked sites.
@hiravgandhi We can continue wherever makes the most sense.