OrchardCore: Admin shouldn't render Header inside

As pointed out by @bleroy on gitter TheAdmin Layout has a header section / zone which is rendered inside the `<head> section, and would produce invalid html if rendered too.

    @await RenderSectionAsync("Header", required: false)
</head>

The SafeMode theme has the same issue.

We just need to figure out where a Header zone should be rendered in TheAdmin i.e. before main content, or before side navigation (probably just before main content), or if we should remove the zone entirely.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (15 by maintainers)

Most upvoted comments

In some of my themes, I call this zone Meta or HeadMeta.

Ok, so confusion sorted.

Let’s get a bit of uniformity and consistency, and see if we can please everyone.

I hope we can agree that the Header zone has both historically, with O1, and in the current OC front end themes refers to a zone that should be rendered early in the <body>

I don’t think it’s great practise to have a zone in the <head> section where invalid html can be rendered, however it seems we have this zone already in TheAgencyTheme.

Best practise is definitely the use of the Resource Tag Helpers. That’s why we have them.

AFIK style tag Helper doesn’t support child content only url to css file is supported.

We should add this Niraj if it is missing and useful.

Equally I don’t want to break what users are currently doing… and if used with care not to produce invalid html…

So will do a small pr, and move the Header zone where it should be in TheAdmin (it does have to be before Messages, or with the navbar css nothing will render) and add a HeadMeta zone.

@deanmarcussen we use both, <resource type="Header"/> using style/script tag helper and <zone name=“Header”> to add adhoc styles/scripts/meta/base within shape templates with intention to render in <head> tag for admin.

AFIK style tag Helper doesn’t support child content only url to css file is supported.

I guess it’s browser’s default behavior to render HTML If <head> contains renderable HTML tags

IMO we need to keep <zone name=“Header”> in <head>

AFAIK HEADER should be rendered inside <head> unless it means the header of the website