Jump to:

22996 Posts in 11620 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » sitetree pages, sometimes loose meta-title and description fields

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 779 Views
  • DsX
    Avatar
    Community Member
    178 Posts

    sitetree pages, sometimes loose meta-title and description fields Link to this post

    I am noticing that sometimes in the cms that my pages will loose a couple fields from the Content/Metadata tab.
    The fields that go missing are the title and description fields.
    The last case of this (just happened) occurred after selecting another page in the left pane and duplicating it.
    This is now the second time I have had this occur, the first I edited the title direct in the database..
    I would rather not have to continue this way, so I am hoping that someone has come across this before??

  • DsX
    Avatar
    Community Member
    178 Posts

    Re: sitetree pages, sometimes loose meta-title and description fields Link to this post

    OK, just tried adding a new page and still the fields are gone...
    will have a look to see if I removed the fields in code somehow... can't imagine do that though.

  • johnraz
    Avatar
    Community Member
    2 Posts

    Re: sitetree pages, sometimes loose meta-title and description fields Link to this post

    Hi,

    I have the same problem here. Im curious what have you found to solve this problem. Thanks!

    john

  • johnraz
    Avatar
    Community Member
    2 Posts

    Re: sitetree pages, sometimes loose meta-title and description fields Link to this post

    Hi,

    I just managed to fix this problem. this happens when you have conflict in your field names. For example you have a field named "Description" under Root.Content.Metadata and another "Description" in Root.Content.Whatever.

    Hope this helps

  • johnmblack
    Avatar
    Community Member
    61 Posts

    Re: sitetree pages, sometimes loose meta-title and description fields Link to this post

    Also watch how you define custom Getters. If you create a custom getter method for a field, and follow the pattern suggested in the tutorials, you might end up with these issues because _the CMS also ends up calling them_ to load its values.

    A better approach would be to create custom getters for display purposes by naming them differently, like:

    function getDisplayTitle() { return 'customPrefix ' . $this->getTitle(); } // or whatever

    Then in the templates, you are always using $DisplayTitle and never $Title. This ensures that your pages will always use the custom logic, but the CMS will always load the original, actual value.

    779 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.