Aspnetcore-angular-universal: Prerendering Module From Razor

Created on 26 Apr 2017  路  9Comments  路  Source: TrilonIO/aspnetcore-angular-universal

@MarkPieszak

Can we still use the same Razor code which we could use in Angular2 + Angular2-Universal.
See code below:

<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>

<script src="~/dist/vendor.js" asp-append-version="true"></script>
@section scripts {
    <script src="~/dist/main-client.js" asp-append-version="true"></script>
}

As your approach moreover looks like controller approach. But we want to make it using Razor.

question

Most helpful comment

Mark, just sign up Github to say thank you! Keep up the good work! :)

All 9 comments

Unfortunately we can't use TagHelpers in this instance because we're trying to get back all the necessary SEO data from Angular itself.

If you don't care about Server rendering / SEO you could just put there and comment out the server code in HomeController.

In the end the approach is the same, this code is invoking node etc / the same way I am in HomeController, but it does nothing but Prerender, we gain no SEO benefits since we can't abstract out the data we need and let .NET put it through out the View.

Hope that makes sense?

@MarkPieszak I we do not want SSR, could you please provide an example of Index action? And please explain how the css files are injected into a _Layout(it used to be vendor.css...).

Sure, the goal is to bring all of those things back, with movers coming tomorrow and a big trip it's just a bad week for me to get anything done. Soon I promise! 馃樋

@MarkPieszak No worries. Take your time. All your hard work is very appreciated by everyone in my team ;) We are hungry for any of commits to this project ;)

Appreciate it and I'm glad! 馃憤

Mark, just sign up Github to say thank you! Keep up the good work! :)

Thank you @hoangdovan 馃憤馃尨馃巿

@MarkPieszak

Current implementation is not supporting pre rendering using helper tags. Is it?

Loading...

Getting below error: It seems because of request params.

image

Please correct me if I am doing all wrong, as I just need to handle pre-rendering and don't want to go with controller approach.

Thanks in advance :)

We don't support tag helpers within this setup no unfortunately, if you use tag helpers you get no SEO benefits, just prerendering (which is pointless without SEO 馃槗)

Was this page helpful?
0 / 5 - 0 ratings