Customize the URL Path structure

How to customize the URL path structure?

Some changes I’d like to make:

  • Remove the word branch from the URL. Such as in the current path structure:<user>/<repository>/raw/branch/<branch_name>/

I could not find anything in the documentation mentioning it.

  • Move the word raw to be a subdomain, and become something like:<user>/<repository>/<branch_name>/

I know this is possible via a proxy, but I’m wondering if I can do it directly on Gitea.

Sometimes, a tag can have the same name with a branch. That’s why we have a prefix before branch_name.

For the second, it really belongs to a reverse proxy reponsibility.

1 Like

If you are very intent on doing this without reverse proxy, you could modify Gitea and compile your own binary.

  1. You can change routes in this file gitea/web.go at main · go-gitea/gitea · GitHub. You will have to make the relevant modifications to templates as well. Note that this change is probably not ideal like lunny mentioned.

  2. The raw link can be amended in the template, or modify the raw route to redirect to the raw domain in the code. Most maintainable would be to change the template, since you can provide official Gitea binary with custom templates.

1 Like