How to change title property of page under SEO tab from code?

Vote:
 

How to change title property of page under SEO tab from code?

#205289
Jul 04, 2019 11:52
Vote:
 

Hi Muller,

So the title property is a custom property that you created in the code base or it is coming from any Addons?

Thanks

Ravindra

#205294
Jul 04, 2019 13:08
Vote:
 

I am using  Alloy now. It is shown in SEO tab of page. It could me MetaTitle.

#205295
Jul 04, 2019 13:24
Vote:
 

Just change the "GroupName" of the title property.

        [Display(
            GroupName = Global.GroupNames.MetaData,
            Order = 100)]
        [CultureSpecific]
        public virtual string MetaTitle { get; set; }
#205298
Jul 04, 2019 13:38
Vote:
 

I have MetaTitle as below. My page is inherited from SitePageData. I cannot set MetaTitle in my page.

public abstract class SitePageData : PageData, ICustomCssInContentArea
    {
        [Display(
            GroupName = Global.GroupNames.MetaData,
            Order = 100)]
        [CultureSpecific]
        public virtual string MetaTitle
        {
            get
            {
                var metaTitle = this.GetPropertyValue(p => p.MetaTitle);

                // Use explicitly set meta title, otherwise fall back to page name
                return !string.IsNullOrWhiteSpace(metaTitle)
                        ? metaTitle
                        : PageName;
            }
            set { this.SetPropertyValue(p => p.MetaTitle, value); }
        }
}
#205302
Jul 04, 2019 14:46
Vote:
 

Just change the "GroupName" in SitePageData class because this is also a custom class or do you want to change the tab name for your page only?

#205303
Jul 04, 2019 14:52
Vote:
 

Hi Muller,

You can not directly set value values to the epi pages or block. You need to get the instance using IContentRepository and after updating value save it back.

Here is a block will help you.

http://joelabrahamsson.com/working-programmatically-with-local-blocks-in-episerver-7/

Let me know if you are still facing issue.

Thanks

#205317
Jul 05, 2019 4:10
Vote:
 

I have the same question

#262163
Sep 13, 2021 15:19
Praful Jangid - Sep 13, 2021 16:46
Are you facing any challenges?
Or, you got your answers?
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.