Chi Chan
Chi Chan

Reputation: 12350

Storing a list of entities in Umbraco

I am wondering what is the best way to store a list of entities in Umbraco.

Say, I have a page that list a bunch of contact information (name, company address, phone number, etc...). I want a web administrator to be able to easily create and edit them inside Umbraco.

Should I be creating a new Data Type call Contact. And have those properties in that Data Type?

If so, is this a good practice? I always think each node in Umbraco is suppose to be a page.

If not, what other options do I have?

Thank you,

Chi

Upvotes: 3

Views: 1822

Answers (2)

Oleksandr Skrypnyk
Oleksandr Skrypnyk

Reputation: 394

Today the best way to store list of entities which will not have pages is Archetype. It's an Umbraco 7 property editor that wraps other installed property editors. By wrapping the other properties, Archetype allows for custom and repeatable fieldset mashups. Archetype documentation - https://github.com/kgiszewski/ArchetypeManual

Upvotes: 1

marapet
marapet

Reputation: 56446

Each node in Umbraco does not necessarily have to be a page. You can have child nodes (not pages) which constitute a list to be displayed on their parent node (a page).

For example: you could have a document type called ContactList. The corresponding template will look for all child nodes having the document type Contact and list them. The Contact document type has all the properties you need for a contact. You do not need to assign a template to the Contact document type (or a NullTemplate, displaying nothing).

Advantages of using nodes for each contact:

  • The user can use the publishing features of content nodes
  • The user can manipulate the sort order within Umbraco as with any node
  • The data of each Contact is stored in the umbraco.config and can be interrogated like any property of any node (xslt, razor).

Of course, there are limits. For example, if you have more than 40-50 contacts, this will be difficult to use. Or if you have to regularly import or synchronize contacts, some additional programming effort will be required.

Upvotes: 5

Related Questions