1

I have added @Html.Partial("/Views/Common/Meta.cshtml", metaModel) in the <head> tag in the page layout but the links and other tags present in the meta.cshtml file are getting rendered in the <body> tag.

Meta.cshtml enter image description here

Layout enter image description here

7
  • Did you make sure that you are using the correct Layout File associated with your page? Commented Jul 4, 2023 at 7:19
  • yes, already checked that
    – Test User
    Commented Jul 4, 2023 at 7:48
  • Can you include cshtml of both layout and meta files in your question?
    – Marek Musielak
    Commented Jul 4, 2023 at 7:52
  • @MarekMusielak added the screenshots for both the files
    – Test User
    Commented Jul 4, 2023 at 8:13
  • Remove all the <input> tags from your meta partial. Potentially they cause that <head> tag is closed automatically as they are not valid inside <head>
    – Marek Musielak
    Commented Jul 4, 2023 at 10:12

1 Answer 1

0

All elements after the first <input> tag will be rendered in the <body> tag, just put all <input> tags at the end of the partial view file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.