Gitea: Custom Routing / new Pages?!

Created on 5 Jul 2017  路  5Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): v1.1.2
  • Git version: 2.11.0
  • Operating system: Ubuntu 17.04
  • 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: None

Description

Is there any way to create custom pages with the templating engine and custom routes?

Here in germany, we need at least two custom sites (imprint and privacy policy) and it would be great, if i could create this two sites in the custom directory.

The template files can already be created in _custom/templates_ but how do i define the routing?

It looks like the routing is made in go files in the _routers_ directory? That means i would have to edit the source files? (And updates would destroy my changes?)

Screenshots

None

kinenhancement

Most helpful comment

Hi, I've added that information to the docs and also listed all the other template hooks at the PR "Improve documentation about custom templates. #3345"

All 5 comments

Probably this could be created adding new reserved name pages and something like Gitea wiki but editable only by admins

After #3308 "Templates for extra links in top navbar and repo tool tabs." you can do this by placing your extra sites/pages under your "custom/public/" directory (for instance custom/public/impressum.html) and putting links to them in custom/templates/custom/extra_links.tmpl:
https://docs.gitea.io/en-us/customizing-gitea/#customizing-gitea-pages

To match the current style, the link should have class name "item":
<a class="item" href="{{AppSubUrl}}/impressum.html">Impressum</a>

That should be added to docs

Hi, I've added that information to the docs and also listed all the other template hooks at the PR "Improve documentation about custom templates. #3345"

Sounds good. Im closing this issue now

Was this page helpful?
0 / 5 - 0 ratings