spanezz / staticsite

Static site generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Link traversal toward the root does not appear to work

hartmans opened this issue · comments

Using 2.4-1 from Debian, I find the following in the markdown feature documentation:

Relative links are resolved relative to the location of the current page first,
and failing that relative to its parent directory, and so on until the root of

So, if I have a page blog/2020/Hermes.md that links to blogpost98-Yule-Return-of-the-Sun, I would expect it to eventually find that blog/2020/Yule-Return-of-the-Sun.md declares the alias aliases: blogpost98-Yule-Return-of-the-Sun and find that aliased page in the root of the site.
(I'm converting one of my blogs from tikiwiki to staticsite)
I was expecting a bug in the alias logic, so I tried to debug, starting at site.py:resolve_path.

  • That calls root.lookup_page, with root markdown:blog/2020/Hermes.md
  • That calls self.search_root_node.llookup_page (search_root_node being 2020)
  • That looks in self.sub which isn't a match
  • Then self.build_pages which also isn't a match
  • Then by_src_relpath, which also isn't a match
  • And then unwinds to eventually raise a page not found error
    I didn't see any recursion in that path, either for aliases or for normal nodes.
    Can I get a hint as to how this is expected to work so I can do a better job trying to debug?
    (This is not critical at all; this is a new code base for me and I'm trying to be helpful and hopefully suggest a fix, but I have not tracked through all the layers).

For my specific use case I think I can through in a regexp replace as I go from tikiwiki to markdown and solve my specific problem, but I'd like to understand how this ought to work.