Open Closed

how add seo from cms kit admin pages ? #9825


User avatar
0
devmahmod created

I want to add meta tags and ld+json for cms page created by admin i'm workin with mvc core razor


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To add SEO meta tags and ld+json structured data to CMS pages created via the ABP CMS Kit (MVC Core Razor):

    1. Extend the CMS Page Rendering:

      • Override the Razor Page or View that renders your CMS Kit dynamic pages (typically under /Pages/Cms/Pages/Detail.cshtml or similar).
      • In this view, access the page's metadata (title, description, etc.) from the CMS Kit's page entity.
    2. Add Meta Tags:

      • In the <head> section of your layout or the specific page view, inject meta tags dynamically using the page's properties.
    @model Volo.CmsKit.Public.Pages.PageDto
       @{
           Layout = "_Layout";
       }
       <head>
           <title>@Model.Title</title>
           <meta name="description" content="@Model.Description" />
           <meta property="og:title" content="@Model.Title" />
           <meta property="og:description" content="@Model.Description" />
           <!-- Add more meta tags as needed -->
       </head>
    
    1. Add ld+json Structured Data:
      • Insert a <script type="application/ld+json"> block in the page, using Razor to serialize your data.
    <script type="application/ld+json">
       @{
           var jsonLd = new {
               "@context" = "https://schema.org",
               "@type" = "Article",
               "headline" = Model.Title,
               "description" = Model.Description,
               "datePublished" = Model.CreationTime.ToString("yyyy-MM-dd"),
               "author" = new { "@type" = "Person", "name" = Model.CreatorName }
           };
           var json = System.Text.Json.JsonSerializer.Serialize(jsonLd);
       }
       @Html.Raw(json)
       </script>
    
    1. Custom Fields (Optional):

      • If you need custom SEO fields (like custom meta description or keywords), extend the CMS Kit Page entity and admin UI to support these fields, then render them as above.
    2. Reference:

      • For more on customizing CMS Kit pages, see the official documentation and demo source code.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The cmskit page will use the ABP layout from the theme module.

    You can override the layout to add your custom meta elements. Get the current page info by Slug to determine your logic.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37