5 ms·
Yup, here's the problem [0]: def calculate_backlinks( pages: Dict[str, Page], attachments: Dict[str, Attachment] ) -> None: for page in pages.v
by algas 3y ago
Yup, here's the problem [0]:
def calculate_backlinks(
pages: Dict[str, Page], attachments: Dict[str, Attachment]
) -> None:
for page in pages.values():
for link in page.links:
linked_page = find(pages, attachments, link)
if not linked_page:
info(f"unable to find link", link, page.title)
continue
linked_page.backlinks.append(page)
No deduplication performed. Since he's parsing the backlinks directly out of the markdown, you don't have to worry about a recursive loop where the backlinks section on one page appears as links in another. A simple solution would be to change the datatype of backlinks from list to set.
[0] From OP's static site generator: https://github.com/llimllib/obsidian_notes/blob/main/run.py https://github.com/llimllib/obsidian_notes/blob/main/run.py