How do I remove navbar items

Is there a way to remove navbar items? I’ve tried creating a custom .tmpl file which points to another custom css file as a way to hide the items, but no changes were seen on the webpage.

Yes, there is. Note that the pages will still be accessible when visited directly by the URL. You would want to copy your Gitea version’s templates/base/head_navbar.tmpl (here is 1.20’s).

You will then need to modify your copy to remove the navigation element, for example removing “Explore”:

...
		{{if .ShowMilestonesDashboardPage}}<a class="item {{if .PageIsMilestonesDashboard}}active{{end}}" href="{{AppSubUrl}}/milestones">{{.locale.Tr "milestones"}}</a>{{end}}
		{{end}}
-		<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
-	{{else if .IsLandingPageOrganizations}}
-		<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{.locale.Tr "explore"}}</a>
-	{{else}}
-		<a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
	{{end}}

Then, in order for your template override to be used in Gitea, you will need to make it available at $GITEA_CUSTOM/templates/base/head_navbar.tmpl. If you’re not sure where that is, you can find it in Site Administration seen below:

See also documentation on modifying Gitea’s templates.

1 Like