dotnet / dotnet/aspnetcore

Discussion, HeadContent development

Open
#45,709 6 comments 1 reaction 0 assignees View on GitHub
area-blazor design-proposal enhancement feature-blazor-builtin-components
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Currently, we have ```` for head tags.

It lacks default values, let's assume we have a tag like this:
``````
We can put it in _Host.cshtml which will be available on every subpage. What if a subpage wants to modify it? There are currently two ways:
1.) Duplication of the value by HeadContent + _Host.cshtml. bad for SEO
2.) Every subpage should be placed in HeadContent, good for seo but bad for programmer. Code duplication and lots of problems

Alternatively, we can create an intermediate code, unfortunately also bad for the programmer. You will need to remember about the implementation on each page, example:
```razor

@AppState.Provider

```

I propose to create a default value during definition. That is:
```razor

```

Then, when compiling the code, razor will detect whether there is already ```` in ````, if so, it will replace its value, if not, it will do nothing.

### Describe the solution you'd like

Let me know what you think about it, I think it's worth discussing this idea and expanding on such a basic thing that has been omitted.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.