Improve site navigation structure
Deploy / deploy-master (push) Skipped
Deploy / deploy-dev (push) Successful in 12s
Deploy / app-quality (push) Successful in 1m8s
Deploy / secret-scan (push) Successful in 4s
Deploy / security-deps (push) Successful in 6s
Deploy / app-image (push) Successful in 1m1s
Deploy / validate-dispatch (push) Successful in 1s
Deploy / scheduled-rebuild-dev (push) Skipped
Deploy / scheduled-rebuild-master (push) Skipped
Deploy / rollback-dev (push) Skipped
Deploy / rollback-master (push) Skipped
Deploy / changes (push) Successful in 3s
Deploy / context (push) Successful in 1s
Deploy / deploy-master (push) Skipped
Deploy / deploy-dev (push) Successful in 12s
Deploy / app-quality (push) Successful in 1m8s
Deploy / secret-scan (push) Successful in 4s
Deploy / security-deps (push) Successful in 6s
Deploy / app-image (push) Successful in 1m1s
Deploy / validate-dispatch (push) Successful in 1s
Deploy / scheduled-rebuild-dev (push) Skipped
Deploy / scheduled-rebuild-master (push) Skipped
Deploy / rollback-dev (push) Skipped
Deploy / rollback-master (push) Skipped
Deploy / changes (push) Successful in 3s
Deploy / context (push) Successful in 1s
This commit is contained in:
@@ -19,6 +19,7 @@ const projects=read("data/projects.json");
|
||||
const demographics=read("data/demographics.json");
|
||||
const administration=read("data/administration.json");
|
||||
const community=read("data/community.json");
|
||||
const navigation=read("data/navigation.json");
|
||||
const sourceIds=new Set(sources.map((item)=>item.id));
|
||||
const unique=(items,key,label)=>{const seen=new Set();for(const item of items){const value=item[key];if(seen.has(value))throw new Error(`Doppelter ${label}: ${value}`);seen.add(value);}};
|
||||
unique(events,"slug","Termin-Slug");unique(news,"slug","News-Slug");unique(pages,"slug","Seiten-Slug");unique(sources,"id","Quellen-ID");
|
||||
@@ -32,4 +33,10 @@ for(const record of [demographics,administration,...projects]){if(record.status!
|
||||
if(community.cultureCommittee.status==="needs-verification"&&community.cultureCommittee.privacyApproved!==false)throw new Error("Ungeprüfter privater Kontakt darf nicht freigegeben sein.");
|
||||
const routeSet=new Set(["/","/aktuelles","/termine","/impressum","/datenschutz","/barrierefreiheit",...pages.map((page)=>`/${page.slug}`),...events.map((event)=>`/termine/${event.slug}`),...news.map((item)=>`/aktuelles/${item.slug}`)]);
|
||||
for(const page of pages){for(const section of page.sections){for(const link of section.links??[]){if(link.href.startsWith("/")&&!routeSet.has(link.href.split("#")[0]))throw new Error(`Interner Link ohne Ziel auf ${page.slug}: ${link.href}`);}}}
|
||||
const navigationRoots=new Set(navigation.groups.map((group)=>group.href));
|
||||
const navigationChildren=navigation.groups.flatMap((group)=>group.children.map((item)=>item.href));
|
||||
unique(navigationChildren.map((href)=>({href})),"href","Navigationsziel");
|
||||
for(const href of [...navigation.direct.map((item)=>item.href),...navigationRoots,...navigationChildren]){if(!routeSet.has(href))throw new Error(`Navigation ohne Ziel: ${href}`);}
|
||||
const expectedNavigationChildren=pages.map((page)=>`/${page.slug}`).filter((href)=>!navigationRoots.has(href)).sort();
|
||||
if(JSON.stringify([...navigationChildren].sort())!==JSON.stringify(expectedNavigationChildren))throw new Error("Statische Fachseiten und Navigationsunterseiten stimmen nicht überein");
|
||||
console.log(`Content validiert: ${pages.length} Seiten, ${news.length} Meldung, ${events.length} Termine, ${sources.length} Quellen.`);
|
||||
|
||||
Reference in New Issue
Block a user