For example:
[{
id:\'our-purpose\',
title:\'Our Purpose\',
slug:\'/our-purpose\',
backgroundImage:\'images/bg-our-purpose.jpg\',
showInNa
Here's a start (in some mix of JavaScript and pseudocode):
function createMenu(data) {
create UL
for each item in data {
create LI for item in UL
if the item has subpages {
append createMenu(item.subpages) to the LI
}
}
return UL
}
function findByID(data, id) {
for each item in data {
if(item.id==id) {
return the item
}
if item has subpages {
if findByID(item.subpages, id) is not null, return the result
}
}
return null;
}