custom/templates override does not work #2173

Closed
opened 2025-11-02 04:26:09 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @methodbox on GitHub (Aug 11, 2018).

  • Gitea version (or commit ref): 1.5
  • Git version: 2.18
  • Operating system: CentOS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

This was previously closed as a “question” about a subject which was not the purpose of the issue.

I want to be clear: this is NOT using custom/templates/custom.

Please do not close this and refer to your docs or forum, as this is **not working as documented. From your own docs:

Customizing Gitea pages

The custom/templates folder allows changing every single page of Gitea. Templates to override can be found in the templates directory of Gitea source. Override by making a copy of the file under custom/templates using a full path structure matching source.

The issue is simple: creating [gitea root dir]/custom/templates/base/head.tmpl and importing the default head.tmpl will not allow Gitea to run, which means it can’t be overridden.

Putting a simple head.tmpl with just html allows it to run but this prevents making simple modifications (like removing buttons) a real pain.

I’ve worked around it by making a custom .../custom/templates/header.tmpl (not a typo) and importing JS to remove the elements I don’t want, which is a hack, not a solution.

If there is a better way to modify the navigation links than replacing the head.tmpl with my own, slightly modified version, I’m all ears.

Screenshots

Originally created by @methodbox on GitHub (Aug 11, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.5 - Git version: 2.18 - Operating system: CentOS - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description This was previously closed as a “question” about a subject which was not the purpose of the issue. I want to be clear: this is NOT using custom/templates/custom. Please do not close this and refer to your docs or forum, as this is **not working as documented. From your own docs: >Customizing Gitea pages >The custom/templates folder allows changing every single page of Gitea. Templates to override can be found in the templates directory of Gitea source. Override by making a copy of the file under custom/templates using a full path structure matching source. The issue is simple: creating **[gitea root dir]/custom/templates/base/head.tmpl** and importing the **default head.tmpl** will not allow Gitea to run, which means it can’t be overridden. Putting a simple head.tmpl with just html allows it to run but this prevents making simple modifications (like removing buttons) a real pain. I’ve worked around it by making a custom .../custom/templates/header.tmpl (not a typo) and **importing JS to remove** the elements I don’t want, which is a hack, not a solution. If there is a better way to modify the navigation links than replacing the head.tmpl with my own, slightly modified version, I’m all ears. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/questionissue/stale labels 2025-11-02 04:26:09 -06:00
Author
Owner

@SagePtr commented on GitHub (Aug 11, 2018):

Do you use base/head.tmpl from master branch and not from release/v1.5 branch ?
It may be incompatible due to addition of extra variables.
For me, head.tmpl from master branch doesn't work either if i use it with 1.5 gitea version.

@SagePtr commented on GitHub (Aug 11, 2018): Do you use base/head.tmpl from `master` branch and not from `release/v1.5` branch ? It may be incompatible due to addition of extra variables. For me, head.tmpl from master branch doesn't work either if i use it with 1.5 gitea version.
Author
Owner

@methodbox commented on GitHub (Aug 12, 2018):

Honestly, your website makes it pretty obscure as to what the actual branch is that is “current”.

I’m using the 1.5 binary.

Let me know if there’s a better option - and maybe update the docs.

Edit - I just realized I think you mean the version of head.tmpl from master with the 1.5 binary, and yes that’s what I did.

Maybe that’s the issue.

It would be nice to have some clarification on exactly which is the “stable” branch, etc.

1.5 is the latest version of the binary on Gitea.io.

@methodbox commented on GitHub (Aug 12, 2018): Honestly, your website makes it pretty obscure as to what the actual branch is that is “current”. I’m using the 1.5 binary. Let me know if there’s a better option - and maybe update the docs. Edit - I just realized I think you mean the version of head.tmpl from master with the 1.5 binary, and yes that’s what I did. Maybe that’s the issue. It would be nice to have some clarification on exactly which is the “stable” branch, etc. 1.5 is the latest version of the binary on Gitea.io.
Author
Owner

@0rzech commented on GitHub (Aug 12, 2018):

@methodbox If I'm not mistaken, you just have to look for release matching your binary on releases page and just click appropriate tag under Latest release link on the left. Currently this would mean clicking on v1.5.0.

@0rzech commented on GitHub (Aug 12, 2018): @methodbox If I'm not mistaken, you just have to look for release matching your binary on [releases](https://github.com/go-gitea/gitea/releases) page and just click appropriate tag under `Latest release` link on the left. Currently this would mean clicking on [v1.5.0](https://github.com/go-gitea/gitea/tree/v1.5.0).
Author
Owner

@methodbox commented on GitHub (Aug 12, 2018):

Okay the help is appreciated. I’ll have to test this Tues and post back as this is in a private environment I do not have remote access to.

@methodbox commented on GitHub (Aug 12, 2018): Okay the help is appreciated. I’ll have to test this Tues and post back as this is in a private environment I do not have remote access to.
Author
Owner

@stale[bot] commented on GitHub (Jan 14, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 14, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Feb 20, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Feb 20, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2173