merged Advertise atom feeds to feed readers #1
~james wants to merge 2 commits from feed-discovery into main · opened 2 hours ago · merged as f8490fe61f
Log in to comment.
Revisions
v1 5a5be3352dv2 4e8b96ff5a range-diff from v1 ▸v3 f8490fe61f range-diff from v2 ▸
Commits
james · 2 hours ago
204ee9ba56 feat(web): advertise commit, issue, pull request and user feeds in the page headVerified ~james
james · 2 hours ago
Changes 2 files, +4 −1
README.md modified
| @@ -18,7 +18,7 @@ Small and lightweight git server for self hosting. Repositories are served over | ||
| 18 | 18 | - Blame, a compare page for any two refs, and tar.gz and zip downloads of any ref. The tar.gz is `git archive --format=tar` passed through a gzip writer with a zeroed header and a fixed level, so the same commit always produces the same bytes and `archive/<ref>.tar.gz.sha256` publishes the checksum that a package recipe can pin |
| 19 | 19 | - Every pushed revision of a pull request is kept under `refs/pull/<n>/v<k>`, and the request page links a `git range-diff` between any two of them, so a reviewer sees what a force push actually changed in each commit instead of rereading the whole series |
| 20 | 20 | - History search on the log page through git's pickaxe, either commits that change how often a string occurs (`-S`) or commits whose diff has a line matching a regex (`-G`), which answers when a line arrived or vanished without cloning |
| 21 | -- Atom feeds of commits per branch, of issues and of pull requests per repository, and of every public commit by a user at `~you/feed`, which stand in for notifications when mail is not configured | |
| 21 | +- Atom feeds of commits per branch, of issues and of pull requests per repository, and of every public commit by a user at `~you/feed`, which stand in for notifications when mail is not configured. Each page names its feeds in a `<link rel="alternate">`, so a reader finds them from the ordinary page URL | |
| 22 | 22 | - Rename, transfer to another user and archive from the repository settings. An archived repository refuses pushes, pull requests and comments but stays readable |
| 23 | 23 | - An optional email address on each account, verified by a link, used for password resets and for notifications about pull requests, reviews and issues on your repositories. Both can be turned off and nothing works without the address, so the whole thing is opt in |
| 24 | 24 | - TOTP two factor authentication with a QR code for the authenticator app and eight single use recovery codes, which is what a password alone cannot give you on something that accepts pushes |
templates/layout.html modified
| @@ -6,6 +6,9 @@ | ||
| 6 | 6 | <title>{{.Title}}</title> |
| 7 | 7 | <link rel="stylesheet" href="/static/style.css?v={{.Version}}"> |
| 8 | 8 | <link rel="stylesheet" href="/static/highlight.css?v={{.Version}}"> |
| 9 | +{{with .Data}}{{with index . "Page"}}<link rel="alternate" type="application/atom+xml" title="{{.Repo.Path}} commits" href="/{{.Repo.Path}}/feed"> | |
| 10 | +<link rel="alternate" type="application/atom+xml" title="{{.Repo.Path}} issues" href="/{{.Repo.Path}}/issues/feed"> | |
| 11 | +<link rel="alternate" type="application/atom+xml" title="{{.Repo.Path}} pull requests" href="/{{.Repo.Path}}/pulls/feed">{{end}}{{if index . "Profile"}}{{with index . "Owner"}}<link rel="alternate" type="application/atom+xml" title="~{{.Name}} commits" href="/~{{.Name}}/feed">{{end}}{{end}}{{end}} | |
| 9 | 12 | {{if .Math}}<link rel="stylesheet" href="/static/katex/katex.min.css"> |
| 10 | 13 | <script defer src="/static/katex/katex.min.js"></script> |
| 11 | 14 | <script defer src="/static/katex/auto-render.min.js"></script> |
Feed readers look for a
<link rel="alternate">in the page head rather than scraping for links, so a repository page should advertise its commit feed. Paste any repository URL into a reader and it should find the feed.