Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shakib 32 posts 134 karma points
    Mar 09, 2017 @ 18:34
    Shakib
    0

    Populate useo fields through code

    Hi ,
    i add my content dynamically through code.
    what i need is populate useo fields through code.
    can i have an example ?
    my code is somthing like this.

     var newPost = Services.ContentService.CreateContent(umbracoPost.Title, 1213, "Gram");
                newPost.SetValue("textTitle", umbracoPost.Title);
                newPost.SetValue("textBody", umbracoPost.Body);
                newPost.SetValue("textCategory", umbracoPost.Category);
                newPost.SetValue("seoFields", "what goes here ????");
                Services.ContentService.Save(newPost);
    

    thanks

  • Shakib 32 posts 134 karma points
    Mar 10, 2017 @ 13:36
    Shakib
    0

    i actually solved it.

                var useo = new UseoProModel()
                {
                    title = "title of the page",
                    description = "description of the page",
                    keywords = "keywords goes here",
                    nofollow =true,
                    noindex = true,
                    noseo = false,
                    robots = "noindex,nofollow",
                    robots2 = ""
                };
                newPost.SetValue("seoFields", json);
    
Please Sign in or register to post replies

Write your reply to:

Draft