6

I have a linked Component in Page metadata which will contain all localize metadata for a Page. Idea is to keep all content in content Publications and avoid any localization of Pages.

Preference is not to use Component metadata of the main Component for Page metadata but keep Page metadata separate in a Component.

I have done POC and able to fetch linked Component data as Page meta on CD side.

Can anyone please suggest if I am taking the right approach?

I am using following approach to add metadata to a Page;

  1. New TBB in Page Template to fetch Component from metadata and add fields to package.

    public class AddPageMetadata : TemplateBase
    var meta = new ItemFields(page.Metadata, page.MetadataSchema);    
    metaComponent = meta.GetComponentValue("metaContent"); //metaContent is linked Component field in metadata schema
    Package.PushItem("Meta_displayname", package.CreateStringItem(tpl.ContentType.Text, GetDisplayName(metaComponent))); 
    
  2. Modify GenerateDynamicPage : BasePageTemplate Add Page meta fields in Tranform Page.

    var val = Package.GetByName("Meta_displayname");
    string value = val.GetAsString();
    f.Values.Add(value);
    page.MetadataFields.Add("displayname : ", f); 
    
  3. Also made changes to update GenerateSiteMap TBB to add new fields to _navigation.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.