Monorepo for Tangled tangled.org

appview/{repo,pages}: fall back to docs/README for repo frontpage #4581

Closed oyster.cafe
targeting master
Closed opened by and assigned to oyster.cafe
targeting master

Closes #741.

Summary #

GitHub, Gitea/Forgejo and Codeberg all support docs/README as an alternate location for a repository's frontpage when no top-level README exists. Tangled currently only looks at the repo root, so repos that keep their README under docs/ (a common convention) render an empty frontpage.

This adds that fallback:

  • When building the repo index, if no README is found at the repo root but a docs entry exists there, look inside docs/ for a README and use it for the frontpage. The extra lookup only happens when a docs entry was already seen in the root listing, so repos without a docs folder pay no extra cost.
  • When rendering that README as Markdown, relative links and images now resolve against the README's own directory (docs/) instead of the repo root, so a docs/README.md that references ./screenshot.png keeps working.

Testing #

  • go test ./appview/repo/... ./appview/pages/... ./gitutil/...
  • Manually confirmed a repo with only docs/README.md now shows it on the frontpage, and that root-level READMEs are unaffected.

This pull request has no versions submitted yet.