Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

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

Vote:
0

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

#205289
Jul 04, 2019 11:52
Vote:
0

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:
0

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

#205295
Jul 04, 2019 13:24
Vote:
0

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:
0

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:
0

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:
1

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:
0

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.