Custom Routing / new Pages?! #871

Closed
opened 2025-11-02 03:39:49 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @CMiksche on GitHub (Jul 5, 2017).

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

Originally created by @CMiksche on GitHub (Jul 5, 2017). - 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
GiteaMirror added the type/enhancement label 2025-11-02 03:39:49 -06:00
Author
Owner

@lafriks commented on GitHub (Jul 5, 2017):

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

@lafriks commented on GitHub (Jul 5, 2017): Probably this could be created adding new reserved name `pages` and something like Gitea wiki but editable only by admins
Author
Owner

@AlbertoGP commented on GitHub (Jan 10, 2018):

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>

@AlbertoGP commented on GitHub (Jan 10, 2018): 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>`
Author
Owner

@lafriks commented on GitHub (Jan 10, 2018):

That should be added to docs

@lafriks commented on GitHub (Jan 10, 2018): That should be added to docs
Author
Owner

@AlbertoGP commented on GitHub (Jan 10, 2018):

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"

@AlbertoGP commented on GitHub (Jan 10, 2018): 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"
Author
Owner

@CMiksche commented on GitHub (Jan 11, 2018):

Sounds good. Im closing this issue now

@CMiksche commented on GitHub (Jan 11, 2018): Sounds good. Im closing this issue now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#871