Open baktay opened 1 year ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
I'm having this same issue. It isn't limited to Blazor server. In blazor wasm if you have a page defining a HeadContent component with child content that overwrites (instead of merges) with any upstream layout page use of HeadContent. Please change to merge soon. In the meantime, I'm going to have to have every page that uses HeadContent also explicitly inject what the layout page would normally do.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is your feature request related to a problem? Please describe. The problem is I tried to update head section in Blazor Server both from razor pages and main layout page - the razor pages are using. The result is the layout pagge HeadContent items are ignored (for example ones Index.razor (having @layout Layout) appear in HTML and not the ones in Layout.razor. I would put dynamic content to Layout for general and per page meta tags from page. I can't do this from _Host.chtml or _Layout.cshtml since I want to use code and variables in the tag.
Describe the solution you'd like The default behaviour should be to merge
items in layout and child razor pages and components that use HeadContent tag. General and per page meta tags then can be coded from related razor page/component.Applicable Scenarios If you wanted to write decent SEO for a webpage or a SaaS project, this would be very convenient. Think of CookieConsent operation. It is already complicated as is in Blazor Server as cookie operations still requre JS Interop. Its already too late for cookie operations when you get to the razor pages from _hosts page. You could include search engine scripts in head from AcceptCookies component, and Description, Keywords meta tags from child razor pages etc.
Describe alternatives you've considered My work arround was to just go with one HeadContent tag in layout and try to get to it from child pages and components. This comes with lots of state and variable sharing issues. There is no Session variable like the old framework that would be avaliable in the application without the need of statehaschanged commands.
Additional context I have not found any solutions on the web. Event Chat GPT code does not work. When you apply Head tag in Layout and Index page, head tag is created inside body tag. I just becomes a mess.