Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HeadElement working properly after updates on the week 03/12/2021 ? #16

Closed
Tytrobot opened this issue Mar 12, 2021 · 8 comments
Closed

Comments

@Tytrobot
Copy link

Hello,
I'm not sure if I am doing something wrong, but on a SEO check, my page descriptions stopped working.
This was working perfectly in my Blazor server side app. It uses the Blazor.HeadElement code to take care of the tittle and the meta tags. I also ran it on a newly created built in Microsoft code sample with the counter, and published it. It seems to work the same with or without adding the Blazor.HeadElement. This code was working on the production system, even after going to Net 5.
Here are the details.
Microsoft Visual Studio Professional 2019 Version 16.9.1 (fully patched and updated as of 03/12/2021) running on a fully updated and patched Win10 pc. All VS extensions are updated to the current versions, And the HeadElement is at v5.4.1. Compiled for .NET 5.0 framework.
This can be tested using: freetools.seobility.net

Let me know if this works, or if I'm confused.
Thanks, Ty

@jsakamoto
Copy link
Owner

but on an SEO check, my page descriptions stopped working.

This library should work fine in the environment that you told me about in this issue.

Could you tell me about more details what was happened?

For example,

  • Was it no error but the page descriptions were not rendered as you expected? If that is so, could you tell me what was rendered as the page descriptions?
  • Did it show an error message or returned an HTTP 500 Internal server error something like an unhandled exception? If that is so, could you tell me the error message or stack trace of that exception?
  • If you can, could you send the source code to me that can reproduce this problem?

As you know, I'm sorry that there is nothing I can do if I could not get enough information about the problem.
Thank you for your understanding. 😃

@Tytrobot
Copy link
Author

Tytrobot commented Mar 13, 2021 via email

@jsakamoto
Copy link
Owner

@Tytrobot
Sorry to late,

As to the page description, it appear to be blank, no listing.
No errors that I could see.

Hum... it looks like the server-side pre-rendering feature doesn't work correctly.
Could you show me the source code of the Startup.cs of your web app?

@Tytrobot
Copy link
Author

Tytrobot commented Mar 16, 2021 via email

@jsakamoto
Copy link
Owner

jsakamoto commented Mar 16, 2021

@Tytrobot

Is pre-rendering needed for the meta tags to work?

Yes, especially to make it to be recognized by internet crawlers.

If you don't use the "HeadElementService - Server Pre-rendering", the "description" meta tag that you inject by marking up the <Meta /> component (or by using the IHeadElementHelper service) has appeared after when the client-side part of the Blazor runtime's initial tasks are finished.

You can see that on a Web browser's developer tools.

By the way, generic internet crawlers don't process client-side script (there are some exceptions, but anyway).

This means internet crawlers just parse the text that was responded from the server-side of your Blazor Server app - that text is the result of the _Host.cshtml rendered.

As long as you don't enable the "HeadElementService - Server Pre-rendering", the text that the result of the _Host.cshtml rendered doesn't include the result of the <Meta /> component or the IHeadElementHelper service.

So, you have to enable the "HeadElementService - Server Pre-rendering" to make the "description" meta tag that is injected by marking up the <Meta /> component (or by using the IHeadElementHelper service) can be recognized by the internet crawlers.

@jsakamoto
Copy link
Owner

@Tytrobot

To enable the "HeadElementService - Server Pre-rendering", please see the following instructions.

@Tytrobot
Copy link
Author

Tytrobot commented Mar 17, 2021 via email

@jsakamoto
Copy link
Owner

I'm glad to resolve this issue. 😃

Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants