Stop hard-coding 'arne/' as the owner prefix #8

Closed
opened 2026-04-05 13:11:14 +02:00 by arne · 0 comments
Owner

web/templates/home.html hard-codes the string arne/ as the owner prefix in every project-row entry. This works because orbit is single-user today, but the owner is already available on the handler (Handler.owner, set at construction in main.go from the ORBIT_FORGEJO_OWNER environment variable). Threading it through to the template is a two-line change.

Two options worth considering:

  • Wrap the home-page slice in a small view struct with Owner string and Projects []projectSummary, passing that to the template instead of the raw slice.
  • Register an owner function in the template funcmap that returns h.owner.

The view-struct approach is more explicit and easier to extend when the home page grows more top-level fields. The funcmap approach is a one-liner in the handler but leaves the template implicitly coupled to the handler's funcmap.

Scope

In bounds: the home-page template and its handler. Out of bounds: anywhere else arne/ might be hard-coded (the project detail page doesn't display the owner at all, so it's unaffected).

`web/templates/home.html` hard-codes the string `arne/` as the owner prefix in every project-row entry. This works because orbit is single-user today, but the owner is already available on the handler (`Handler.owner`, set at construction in `main.go` from the `ORBIT_FORGEJO_OWNER` environment variable). Threading it through to the template is a two-line change. Two options worth considering: - Wrap the home-page slice in a small view struct with `Owner string` and `Projects []projectSummary`, passing that to the template instead of the raw slice. - Register an `owner` function in the template funcmap that returns `h.owner`. The view-struct approach is more explicit and easier to extend when the home page grows more top-level fields. The funcmap approach is a one-liner in the handler but leaves the template implicitly coupled to the handler's funcmap. ## Scope In bounds: the home-page template and its handler. Out of bounds: anywhere else `arne/` might be hard-coded (the project detail page doesn't display the owner at all, so it's unaffected).
arne changed title from web: thread owner through to templates instead of hard-coding 'arne/' to Stop hard-coding 'arne/' as the owner prefix 2026-04-05 22:33:59 +02:00
arne closed this issue 2026-04-06 09:28:40 +02:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
arne/orbit#8
No description provided.