```dataviewjs
const homePage = dv.pages().where(p => p.uid === "home").first();
if (!homePage) {
throw new Error("No home page found (with uid: home)");
}
const publishedPages = new Set(
dv.pages()
.where(p => p.publish === true)
.map(p => p.file.path)
);
function removeLinkedPages(startPage) {
if (!startPage || !publishedPages.has(startPage.file.path)) return;
publishedPages.delete(startPage.file.path);
const allLinks = [
...(startPage.file.outlinks || []),
...(startPage.file.inlinks || []),
...(startPage.file.embeddings || [])
];
for (const link of allLinks) {
const linkedPage = dv.page(link);
if (linkedPage) {
removeLinkedPages(linkedPage);
}
}
}
removeLinkedPages(homePage);
if (publishedPages.size > 0) {
dv.list([...publishedPages].sort().map(path => dv.fileLink(path)));
} else {
dv.execute('LIST FROM -""');
}
```