One solution is to add them to the startpage, since the startpage is always easy to retrieve from any page.
Thanks a lot, logically that makes sense, and I thought I could work it out myself - but aparently not.. Would you have a simple example of how the property is declared on the startPage (if not in the way I have done it in my example), and a simple example of how to retrieve the property one the startpage from a different site (in the latest episerver version). I can get the startPage with ContentReference.StartPage, but I can't find how to retrieve the property, so I assume I'm doing either the property or the getting wrong :/
Don't you have a content type for the startpage as a model? Then you just add the properties to that model, just like you added MetaDescription to your content type above. Then you retrieve the properties like this, given that your startpage's content type is StartPage:
var startPage = contentLoader.Get<StartPage>(ContentReference.StartPage); var test = startPage.TheProperty;
I'm obviously late to the party, but I wrote a blog post a while ago about the various models of storing global settings: https://www.epinova.no/en/blog/configuration-options-for-episerver-sites/. There are pros and cons for each one, depending on your needs.
Thanks a lot guys, I have been a bit preoccupied, and have not been able to test this, but it seems like solid solutions. Johan, the reason I could not make it work was something else I had done wrong, so your solution is satisfactory. Arild, thank you for providing alternative solutions for alternative cases.
Hi
I'm quite new to EpiServer and are trying to build a basic site. I have created a working set of PageData, following this pattern:
These can be edited for each page, and that's what I want in this case. But my question is this; what is the best practice for creating a similar set of preoperties, but not specific for each page, but rather global for the entire site (this could be contact info that goes in the footer, or other things that I want to reuse across all pages)?
I have searched for this a while, but can't seem to find a solution anywhere, and this seems like a common feature. There's probably some obvious solution that I'm missing here, and I'd really appreciate any help towards solving this.
(I'm on version 10.10.4)