-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSS/Atom support for Repos #19055
Merged
Merged
RSS/Atom support for Repos #19055
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6543
added
the
type/feature
Completely new functionality. Can only be merged if feature freeze is not active.
label
Mar 10, 2022
noerw
approved these changes
Mar 11, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
I wonder where a button in the UI linking to the feed URL could be nicely placed..?
GiteaBot
added
the
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
label
Mar 11, 2022
Here's a diff to advertise the feeds via meta tags:diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index f4d2fccef..4896f16e0 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -698,6 +698,8 @@ func Home(ctx *context.Context) {
return
}
+ ctx.Data["FeedURL"] = ctx.Repo.Repository.HTMLURL()
+
checkHomeCodeViewable(ctx)
if ctx.Written() {
return
diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go
index 718ad6dc7..29687a23c 100644
--- a/routers/web/user/profile.go
+++ b/routers/web/user/profile.go
@@ -75,6 +75,7 @@ func Profile(ctx *context.Context) {
}
uname, showFeedType := feed.GetFeedType(uname, ctx.Req)
+ isShowFeed := len(showFeedType) != 0
ctxUser := GetUserByName(ctx, uname)
if ctx.Written() {
@@ -83,7 +84,7 @@ func Profile(ctx *context.Context) {
if ctxUser.IsOrganization() {
// Show Org RSS feed
- if len(showFeedType) != 0 {
+ if isShowFeed {
feed.ShowUserFeed(ctx, ctxUser, showFeedType)
return
}
@@ -111,11 +112,14 @@ func Profile(ctx *context.Context) {
}
// Show User RSS feed
- if len(showFeedType) != 0 {
+ if isShowFeed {
feed.ShowUserFeed(ctx, ctxUser, showFeedType)
return
}
+ // advertise feed via meta tag
+ ctx.Data["FeedURL"] = ctxUser.HTMLURL()
+
// Show OpenID URIs
openIDs, err := user_model.GetUserOpenIDs(ctxUser.ID)
if err != nil {
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 32e206a95..666246a18 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -14,6 +14,10 @@
{{if .GoGetImport}}
<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
<meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
+{{end}}
+{{if .FeedURL}}
+ <link rel="alternate" type="application/atom+xml" title="" href="{{.FeedURL}}.atom">
+ <link rel="alternate" type="application/rss+xml" title="" href="{{.FeedURL}}.rss">
{{end}}
<script>
<!-- /* eslint-disable */ -->
|
@noerw applyed |
delvh
reviewed
Mar 12, 2022
Co-authored-by: delvh <dev.lh@web.de>
delvh
approved these changes
Mar 13, 2022
GiteaBot
added
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
and removed
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
labels
Mar 13, 2022
11 tasks
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 14, 2022
* giteaofficial/main: [skip ci] Updated translations via Crowdin Fix documentation and go-gitea#19065 (go-gitea#19067) RSS/Atom support for Repos (go-gitea#19055) [skip ci] Updated licenses and gitignores Feeds: render markdown to html (go-gitea#19058) [skip ci] Updated translations via Crowdin
Chianina
pushed a commit
to Chianina/gitea
that referenced
this pull request
Mar 28, 2022
* support for repos * refactor * advertise the feeds via meta tags * allow feed suffix and feed header * optimize performance
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
lgtm/done
This PR has enough approvals to get merged. There are no important open reservations anymore.
type/feature
Completely new functionality. Can only be merged if feature freeze is not active.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #569