The sitemaps Paul create now do include links found in page. These are returned as entries where the key is the slug linked to and the value is the paragraph id where the link was found. Paragraph ids are rarely duplicated but one case were they are is when pages are made from a template. I made a lot of pages this way in my daily photo challenge. I think I will write a little shell script to find these reused ids. This isn't the problem you are solving but you have me interested and I might try turning Paul's sitemap representation into a Graph just to see how that works out.
// get a sitemap const site = `photos.ward.dojo.fed.wiki` const url = `http://${site}/system/sitemap.json` const sitemap = await fetch(url) .then(res => res.json()) console.log({sitemap})
// collect links [from,to,at] const links = sitemap .filter(info => info.links) .map(info => Object.entries(info.links) .map(e => [info.slug,e[0],e[1]])) .flat() console.log({links})
// get ready to make a graph import {Graph} from 'https://wardcunningham.github.io/graph/graph.js' const graph = new Graph() const nids = {} const node = slug => { if (!(slug in nids)) nids[slug] = graph.addNode('Page',{name:slug}) return nids[slug]}
// fill graph with rels typed with paragraph id for (const [here, there, by] of links) graph.addRel(by,node(here),node(there),{id:by}) console.log({graph}) console.log({tally:graph.tally()})
// query graph for a given relation by type const id = "20300030377904197632" const cypher = `match (here) -[by{id:"${id}"}]->(there)` const result = graph.search(cypher) console.log({result})
// format result for easy reading export default result.map(({here,there,by}) => [here.props.name,there.props.name,by.props.id])
In the frame below we can view the results.
//js.ward.asia.wiki.org/assets/pages/js-snippet-template/importjs.html HEIGHT 400
See also Static Import Snippet