question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor: Add a possiblity to pass data from page component to main index.cshtml during prerendering

See original GitHub issue

Problem to solve

We want to use Blazor app as normal web app which has to be SEO friendly. We also want to integrate this app with social sites. To achieve this we have to dynamically build <head> section of html page. We have to have different title, description and metatags for each page.

Describe the solution you’d like

We have prerendering already and main index.html file is now index.cshtml (at least in Blazor server side). One thing is missing. I would like to have some data structure (I want to define it myself) which is accessible to this main index.cshtml file and to all page files. You should make some magic and run prerendering logic first and then render the main index.cshtml file. With this functionality in place each page will be able to assign required information to fields in the data structure and then main html output will be correctly generated by index.cshtml.

This is critical if we want to have proper SEO and integration with social sites.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
danroth27commented, Jul 26, 2019
0reactions
rodumancommented, Aug 9, 2019

Do you plan to do this in Blazor itself? https://community.devexpress.com/blogs/aspnet/archive/2019/07/17/devexpress-blazor-update-metadata-at-runtime- свободный сео-tool.aspx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prerender and integrate ASP.NET Core Razor components
In the project's Index page of a Razor Pages app, add the Counter component's namespace and embed the component into the page.
Read more >
How to pass a parameter to razor component in server-side ...
In the component where you want to accept the parameter you need to have a Property marked as a parameter. Like
Read more >
ASP.NET Core Razor component lifecycle
The Razor component processes Razor component lifecycle events in a set of synchronous and asynchronous lifecycle methods. The lifecycle methods ...
Read more >
A Deep Dive into Html.RenderComponentAsync with ASP. ...
The purpose of this document is to go over the various options to add Blazor to an existing MVC Application. A Deep Dive...
Read more >
Get Your Head Together: Blazor's HeadContent and ...
Let's take a look at the three Blazor components .NET 6 is introducing to help you manage the head of your document—PageTitle, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found