feat(admin): configurable default landing page from site administration #240

Closed
opened 2026-05-30 17:07:57 +00:00 by jmiller · 1 comment
Owner

Summary

Add an admin setting to configure the default landing page for the MokoGitea instance. Currently the home page always shows the explore/repository list. Admins should be able to choose what visitors see when they hit the root URL.

Proposed options

  • Explore (current default) — the repository explore page
  • Specific Organization — redirect to a specific org's page (e.g. /MokoConsulting)
  • Login page — redirect unauthenticated users directly to the login page
  • Custom URL — redirect to any internal path (e.g. /MokoConsulting/MokoGitea/wiki)

Behavior

  • Unauthenticated users: respect the configured default page
  • Authenticated users: optionally redirect to their dashboard instead (existing behavior with LANDING_PAGE = dashboard)
  • The setting should be configurable from Site Administration without editing app.ini

Current state

Gitea already has a LANDING_PAGE setting in app.ini (home, explore, organizations, login, or a custom path). This feature would:

  1. Expose that setting in the admin UI (Site Administration > Settings)
  2. Add the "specific organization" option with an org selector
  3. Make it changeable at runtime without restarting the server

Files to investigate

  • modules/setting/server.go — where LANDING_PAGE is parsed
  • routers/web/home.go — the Home() handler that uses the landing page setting
  • routers/web/admin/config.go — admin config page
  • templates/admin/config.tmpl — admin config template

Created by @MokoBot - Claude Opus 4.6

## Summary Add an admin setting to configure the default landing page for the MokoGitea instance. Currently the home page always shows the explore/repository list. Admins should be able to choose what visitors see when they hit the root URL. ### Proposed options - **Explore** (current default) — the repository explore page - **Specific Organization** — redirect to a specific org's page (e.g. `/MokoConsulting`) - **Login page** — redirect unauthenticated users directly to the login page - **Custom URL** — redirect to any internal path (e.g. `/MokoConsulting/MokoGitea/wiki`) ### Behavior - **Unauthenticated users**: respect the configured default page - **Authenticated users**: optionally redirect to their dashboard instead (existing behavior with LANDING_PAGE = dashboard) - The setting should be configurable from Site Administration without editing app.ini ### Current state Gitea already has a `LANDING_PAGE` setting in app.ini (`home`, `explore`, `organizations`, `login`, or a custom path). This feature would: 1. Expose that setting in the admin UI (Site Administration > Settings) 2. Add the "specific organization" option with an org selector 3. Make it changeable at runtime without restarting the server ### Files to investigate - `modules/setting/server.go` — where LANDING_PAGE is parsed - `routers/web/home.go` — the Home() handler that uses the landing page setting - `routers/web/admin/config.go` — admin config page - `templates/admin/config.tmpl` — admin config template --- *Created by @MokoBot - Claude Opus 4.6*
Author
Owner

Implementation Plan

Current state

Gitea already has full LANDING_PAGE support in app.ini:

  • modules/setting/server.go:30-38 — defines LandingPage type with options: home, explore, organizations, login, or any custom path
  • modules/setting/server.go:312-323 — parses the setting from config
  • routers/web/home.go:51-53 — redirects unauthenticated users to the configured landing page

What is missing: exposing this setting in the admin UI so it can be changed at runtime.

Implementation

1. Add to admin config panel

  • File: routers/web/admin/config.go — add LandingPageURL to the template data
  • File: templates/admin/config.tmpl — add a form section under Server settings with:
    • Radio buttons: Home / Explore / Organizations / Login
    • Text input for custom path (e.g. /MokoConsulting or /MokoConsulting/MokoGitea/wiki)
    • Optional org selector dropdown for the "specific organization" option

2. Admin config POST handler

  • File: routers/web/admin/config.go — handle the POST to update setting.LandingPageURL at runtime
  • The setting change takes effect immediately (no restart needed) since the home handler reads setting.LandingPageURL on every request

3. Persist to app.ini (optional)

  • Write the change to custom/conf/app.ini so it survives restarts
  • Or store in a new system_setting table row (Gitea already has this pattern for some runtime settings)

Scope

This is a small feature — approximately 3 files to modify, no migration needed. The core logic already exists; it is just a UI gap.


@MokoBot - Claude Opus 4.6

## Implementation Plan ### Current state Gitea already has full `LANDING_PAGE` support in `app.ini`: - `modules/setting/server.go:30-38` — defines `LandingPage` type with options: `home`, `explore`, `organizations`, `login`, or any custom path - `modules/setting/server.go:312-323` — parses the setting from config - `routers/web/home.go:51-53` — redirects unauthenticated users to the configured landing page **What is missing**: exposing this setting in the admin UI so it can be changed at runtime. ### Implementation **1. Add to admin config panel** - File: `routers/web/admin/config.go` — add `LandingPageURL` to the template data - File: `templates/admin/config.tmpl` — add a form section under Server settings with: - Radio buttons: Home / Explore / Organizations / Login - Text input for custom path (e.g. `/MokoConsulting` or `/MokoConsulting/MokoGitea/wiki`) - Optional org selector dropdown for the "specific organization" option **2. Admin config POST handler** - File: `routers/web/admin/config.go` — handle the POST to update `setting.LandingPageURL` at runtime - The setting change takes effect immediately (no restart needed) since the home handler reads `setting.LandingPageURL` on every request **3. Persist to app.ini** (optional) - Write the change to `custom/conf/app.ini` so it survives restarts - Or store in a new `system_setting` table row (Gitea already has this pattern for some runtime settings) ### Scope This is a small feature — approximately 3 files to modify, no migration needed. The core logic already exists; it is just a UI gap. --- *@MokoBot - Claude Opus 4.6*
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#240