SEO is simplified in Blazor .Net Core 8. Simply put whatever HTML you may want to use in HeadContent Tag. Dynamic parameters can be added as shown below.
@page "/" <HeadContent> <PageTitle>@title</PageTitle> <meta name="description" content="@description"> <meta name="keywords" content="@keywords" /> <meta name="author" content="@author" /> <meta property="og:type" content="article" /> <meta property="og:title" content="something_og:title" /> <meta property="og:description" content="something_og:description" /> <meta property="og:url" content="something_og:url" /> <meta property="og:site_name" content="something_og:site_name" /> <meta property="og:locale" content="en_US" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:title" content="something_twitter:title" /> <meta name="twitter:description" content="something_twitter:description" /> <meta name="twitter:creator" content="something_twitter:creator" /> <meta name="twitter:domain" content="something_twitter:domain"> <meta name="twitter:site" content="something_twitter:site"> </HeadContent> <h1>Hello, world!</h1> Welcome to your new app. @code { private string description = "Description set by component"; private string title = "Title set by component"; private string keywords = "keyword1, keyword2, keyword3"; private string author = "author1"; }
----
Output
-------
No comments:
Post a Comment