Hi,
Assuming I have a navigation system in a CMS, what is the best approach to define the relationship between pages?
My navigation should be something like this:
- Main Navigation
- Page 1
- Page 1.1
- Page 1.2
- Page 1.2.1
- Page 1.3
- Page 2
- Page 2.1
- Page 2.1.1
- Page 2.2.1
- Page 2.1
- Page 1
- Footer Navigation
- Footer page 1
- Footer page 2
What is the best and safer approach to define the hierarchy and order between pages?
I currently do:
“CMS::PAGES::[PAGE 1.2 GUID]” = {
navigation: “main”
parent: [Page 1 GUID]
name: “Page 1.2”
orderIndex: 1
}
Pros:
I use a view that list by navigation type all my pages and create my navigation JSON on the server.
Cons:
Problem with this solution, when I have to change the position of the page 1.2 to place it before Page 2.1, I need to modify all documents with parent ID of Page 1 and also all documents with parent ID of Page 2.
This approach is not so different from Relational Database Systems.
I’m thinking about a solution like that without using any views:
“CMS::NAV::MAIN::_count” = 2
“CMS::NAV::MAIN::1” = [PAGE 1 GUID]
“CMS::NAV::MAIN::2” = [PAGE 2 GUID]
“CMS::PAGES::[PAGE 1 GUID]::CHILDRENS::_count”: 3
“CMS::PAGES::[PAGE 1 GUID]::CHILDRENS::1”: [PAGE 1.1 GUID]
etc…
and by this way does not set any Parent Id or order index in the page documents.
Pros:
Like that I don’t need to change the document when I have to change the order or append the page to another level of navigation.
Cons:
But with this solution I need to do a lot of GET requests on the database to build my navigation JSON instead of only 1 in the first solution.
What is the best approach between these 2 solutions or is there a 3rd one more easily to implements and manage?
Thanks,
Val.