1

With Microsoft's ASP.NET Javascript Services is it possible to pick and choose which routes get rendered server side?

I need marketing pages like the home page to get rendered on the server for SEO, but the web app pages to only be rendered on the client.

I am using react, react router and asp net core 2.0.

1
  • If it's possible (I'd also like to know), it's probably also possible for Angular Commented Oct 2, 2017 at 14:06

1 Answer 1

0

Use asp-prerender-* in a view, as described here

https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#server-side-prerendering

For example, in your cshtml:

<div id="my-spa" asp-prerender-module="ClientApp/boot-server"
             asp-prerender-data="new {
                IsGoldUser = true,
                Cookies = ViewContext.HttpContext.Request.Cookies
             }"></div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.