Skip to content

Templates: Rendered GitHub's layouts on the server, so pages no longer change after loading - #95

Merged
whereareiam merged 1 commit into
devfrom
refactor/server-rendered-workarounds
Oct 22, 2026
Merged

whereareiam merged 1 commit into
devfrom
refactor/server-rendered-workarounds

Conversation

@whereareiam

Copy link
Copy Markdown
Owner

What changes

Several theme scripts rewrote Forgejo's markup after the page loaded: replacing text, moving elements and overriding inline colours. That work now happens in template overrides and CSS, so pages render correctly before any script runs and nothing jumps after load. The scripts keep only real behaviour.

Area Now rendered by the server Script after this change
Issue and pull request lists Search placeholder, state counters as badges, mobile filter button, "All states" in the type menu, labels below the title, empty state issue-list.js only opens and closes the mobile filter menu
Issue and pull request pages "opened … by" header, "Add a comment" heading, reaction picker below each comment, GitHub's sidebar order; the attach icon is CSS issue-conversation.js only keeps Comment disabled while the editor is empty
Merge box Ready-to-merge header with the signing note, merge actions wrapper pull-review.js only marks scheduled merges
Labels A theme label template passes the colour as CSS variables; the stylesheet computes GitHub's light and dark colours, also for timeline label events repository-labels.js removed
Releases Check status labels in the template; the sidebar's latest release date uses Forgejo's relative-time —
Diff Hunk headers keep their first @; the Vue file tree's icons are CSS —

Text that the templates add uses Forgejo's translation keys where one exists (search placeholders, "opened … by", "No results", "Filter", the check status sentences). "Add a comment" and "All states" stay English because Forgejo has no equivalent.

Not changed: the Actions run page is a Vue component the templates cannot reach into, so actions-run.js stays. Release asset digests and the repository sidebar's latest release still load in the browser because Forgejo exposes no data for them.

Checks

  • bun vitest: 406 tests pass; Prettier check passes.
  • Verified in the Forgejo 17 dev preview against the previous scripts' output: issue and pull request lists, conversations (including adding and removing a reaction), merge box, labels in light and dark mode, releases, repository home, diff view, and a German locale.
  • bun lint could not run locally: the installed typescript-eslint does not support TypeScript 7.

🤖 Generated with Claude Code

… in JavaScript

Several scripts rewrote Forgejo's markup after it loaded: replacing text,
moving elements and restyling inline colours. That work now happens in
template overrides and CSS, and the scripts keep only real behaviour.

- Issue and pull request lists: search placeholder, state counters, mobile
  filter button, "All states", labels below the title and the empty state
  are rendered by the templates.
- Conversations: the "opened" header, "Add a comment" heading, reaction
  picker under the body and GitHub's sidebar order come from the templates;
  the attach icon is CSS.
- Merge box: the ready-to-merge header and merge actions wrapper are
  rendered by pull.tmpl.
- Labels: a theme label template passes colours as CSS variables, so the
  stylesheet adapts them to light and dark mode; repository-labels.js is
  removed. Timeline label events use the same markup.
- Releases: check status labels come from the template, and the sidebar's
  latest release date uses Forgejo's relative-time element.
- Diff: hunk headers keep their first "@", and the Vue file tree's icons
  are drawn in CSS.

Text added to templates uses Forgejo's translation keys where one exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@whereareiam whereareiam added the change Changed look, templates or compatibility label Oct 22, 2026
@whereareiam
whereareiam merged commit 84761cc into dev Oct 22, 2026
8 of 9 checks passed
@whereareiam
whereareiam deleted the refactor/server-rendered-workarounds branch October 22, 2026 15:48
@whereareiam whereareiam changed the title Templates: Render GitHub layouts server-side instead of patching them in JavaScript Templates: Rendered GitHub's layouts on the server, so pages no longer change after loading Oct 23, 2026
rozsazoltan pushed a commit to rozsazoltan-forks/forgejo-github-theme that referenced this pull request Oct 23, 2026
The release draft resolves to 1.0.0 now that whereareiam#94 carries major: its
templates target Forgejo 17, and admins on Forgejo 16 have to stay on
0.4.0. The notes give the summary, the tested Forgejo version and that
upgrade warning. CONTRIBUTING lists Templates as an area, as whereareiam#94 and
whereareiam#95 use it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change Changed look, templates or compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant