New repositories in template? #4481

Closed
opened 2025-11-02 05:52:13 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @bitnom on GitHub (Dec 13, 2019).

Wondering if you can show me an example of how to loop through the most recently created repositories and most stars in homepage template. Same as like /explore/repos?sort=newest&q=

Originally created by @bitnom on GitHub (Dec 13, 2019). Wondering if you can show me an example of how to loop through the most recently created repositories and most stars in homepage template. Same as like `/explore/repos?sort=newest&q=`
GiteaMirror added the type/questionissue/stale labels 2025-11-02 05:52:13 -06:00
Author
Owner

@axifive commented on GitHub (Dec 13, 2019):

Template handler gets already sorted repositories list, so in all cases, it just ranges all and inserts fields according to if conditions.

The template you interested in:
https://github.com/go-gitea/gitea/blob/master/templates/explore/repos.tmpl
and embedded repo_list:
https://github.com/go-gitea/gitea/blob/master/templates/explore/repo_list.tmpl

and handler: f09cdb239c/routers/home.go (L166)

Search repo in DB with orderBy = models.SearchOrderByNewest or models.SearchOrderByStarsReverse conditions:
f09cdb239c/routers/home.go (L137-L147)

@axifive commented on GitHub (Dec 13, 2019): Template handler gets already sorted repositories list, so in all cases, it just ranges all and inserts fields according to if conditions. The template you interested in: https://github.com/go-gitea/gitea/blob/master/templates/explore/repos.tmpl and embedded repo_list: https://github.com/go-gitea/gitea/blob/master/templates/explore/repo_list.tmpl and handler: https://github.com/go-gitea/gitea/blob/f09cdb239cb7e2d96c6bc9d5d43ada165b1240d1/routers/home.go#L166 Search repo in DB with `orderBy = models.SearchOrderByNewest` or `models.SearchOrderByStarsReverse` conditions: https://github.com/go-gitea/gitea/blob/f09cdb239cb7e2d96c6bc9d5d43ada165b1240d1/routers/home.go#L137-L147
Author
Owner

@stale[bot] commented on GitHub (Feb 11, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 11, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4481