Closed msridhar closed 7 years ago
Why does it seem to be the correct behavior to me? RSSlink should be populated only for the homepage and the taxonomy list & term pages but probably not for all posts. In fact, the whole <link>
tag should be removed from individual posts.
I did a bit of reading about the usecase of OP here, and if RSS <link>
is really needed on each page, rel="home"
should be used instead of rel="alternate"
, see: MDN Syndicating
@k4rtik for me, the desired behavior is that if some reader follows a link directly to one of my posts, she should be able to easily subscribe to the RSS feed in the same manner she would use if she navigated to the main page. From your link, it does seem that rel="home"
would be more appropriate for post pages.
I think I figured it out.
RSSlink
is being populated only for main, sections and taxonomies as expected (see doc: http://gohugo.io/templates/rss/).
The correct way to solve your problem is by fixing the theme. You might want to keep the RSS section of <head>
separate for your posts template and for other templates (main/section/taxonomy) OR get rid of it completely for posts (which you probably don't want as mentioned in previous comment).
This is not a hugo bug then, rather a theme bug. Please feel free to close the issue if you think it's clear now.
There’s two different bugs here. I think you’re right that themes need to be fixed, but I also think that having .Site.RSSLink
would make it easier for themes to do the right thing, e.g.:
{{ if .RSSlink }}
<link href="{{ .RSSlink }}" rel="alternate" type="application/atom+xml" title="{{ .Site.Title }}" />
{{ else if .Site.RSSlink }}
<link href="{{ .Site.RSSlink }}" rel="home" type="application/atom+xml" title="{{ .Site.Title }}" />
{{ end }}
That sounds like a pretty good alternative to me.
node.RSSlink
is a method. If the example @halostatue shows is the "correct way", the conditionals in his example should be put in that method ... will make the templates simpler to write.
@bjornerik Except for the difference between rel="alternate"
and rel="home"
. ;)
I admit I'm not fully following the discussion, but I'll note that if the theme is buggy, it is also buggy in the spf13/hyde repository:
https://github.com/spf13/hyde/blob/master/layouts/partials/head.html#L23
Let me know if I should file an additional issue there, or if the issue should be there instead of here.
@msridhar I spent some time looking at the specs that @k4rtik also looked at, and they are somewhat open for interpretation…but basically, <link rel="alternate"…>
means that what is there is an alternate link for the page you’re viewing, so pointing to the site RSS feed (or a category RSS feed) as an alternate link from an individual page isn’t accurate. In that sense, pretty much every theme out there for Hugo is buggy…
…but so is pretty much every WordPress theme, etc.
So, there are two things that should be done:
.Site.RSSlink
that can be used if .RSSlink
is not set..Site.RSSlink
in the following fashion (this is a little different than I originally wrote) so that they aren’t buggy. (This also means that each taxonomy/category page will present both RSS feeds.){{ if .RSSlink }}
<link href="{{ .RSSlink }}" rel="alternate" type="application/atom+xml" title="{{ .Site.Title }}" />
{{ end }}
{{ if ne .RSSlink .Site.RSSlink }}
<link href="{{ .Site.RSSlink }}" rel="home" type="application/atom+xml" title="{{ .Site.Title }}" />
{{ end }}
I rewrote some mechanics of feed generation in Hugo today at #644, there were nasty bugs here and there, especially in relation to standards compliance, alternate links and placement of generated xml files themselves. Although, it doesn't address the .Site.RSSLink
issue because I am unclear about how to add it, please have a look if you like.
For my website, at least, I have removed the rel=alternative link for individual posts using https://github.com/k4rtik/liquorice/commit/224cd5bee2eafa793742f97e474f14522470fc12
BTW, @halostatue the MIME type in your examples should be application/rss+xml
if we are using RSS 2.0, isn't it?
You’re right that it should be application/rss+xml
, but as you said in #644, we should switch the internal RSS template to an actual Atom template.
I’ll look at your code in that PR a bit later.
The stakeholders of this bugg: What is status?
As far as my understanding goes, this should not be an issue anymore. Feedly can successfully find the feed in all kinds of pages on my site. I am on v0.14. But then I had hacked/corrected my theme as mentioned earlier.
Perhaps @msridhar might be able to say for sure about the specific problem he described.
@k4rtik What exactly is the theme fix? With hugo 0.14 and the fix in this comment I get an error that .Site.RSSLink
is not defined.
@msridhar it is to not expose alternate link for individual blog posts or pages.
Please see: https://github.com/k4rtik/liquorice/commit/224cd5bee2eafa793742f97e474f14522470fc12 for what I did in my case. This ensures that feed is served only for those pages for which Hugo provides a RSS link (homepage, sections, category/tags pages, etc.)
@k4rtik with this change will Feedly still find a feed on pages for individual posts?
More specifically, I'd still like the "Subscribe" button that one can enable in Firefox to work on individual post pages. I think that looks for a <link>
element giving the URL of the feed.
@msridhar I am not sure how Feedly discovers a feed exactly, but on my individual posts I see the icon active though the alternate link is not there if I look up the source of the page.
Why don't you try it out once?
I checked, and Firefox's RSS Subscribe button does not work on individual posts with the equivalent of k4rtik/liquorice@224cd5b enabled. @k4rtik I went to the site linked from your GitHub profile, and I don't see the button enabled there for individual posts either (though it is enabled for the main page, as expected). When you say that you see an active Feedly icon on your individual posts, what do you mean exactly? Do you have a browser extension installed?
Disappointingly, I tried manually introducing a <link>
element with rel="home"
on my post pages, and the Firefox subscribe button doesn't work in that case either; I guess it is only looking for the incorrect rel="alternate"
tag. I can file a separate bug with them for that issue.
Bottom line, though it may technically violate the specification, I think hugo should support some way for templates to reference the RSSLink
URL on individual posts. Having rel="alternate"
links on individual posts is extremely common on blogs, from what I can see. Perhaps enabling the .Site.RSSLink
variable as suggested by @halostatue would be the best solution.
Also, the bug title mentions the permalinks.posts feature, but I'm now unsure if that has anything to do with this issue. If not, we can rename the issue to something more appropriate.
Yeah, I was talking about the Feedly Mini extension. Ideally it should also NOT detect feeds on individual pages as there aren't any <link>
tags for feeds on those.
I couldn't test out myself with Firefox (don't have it installed, traveling & on a slow network connection). But yes, if it doesn't detect the feed with <link rel="home" ...>
, letting them know is a good idea.
I cannot comment on other points you raised at this point.
Glad I found this issue. Run into the same issue. Only realized it because the RSS link was not working on sub pages.
After reading this and testing, I set the <link>
to rel="alternate"
for all pages to support Firefox.
Also, I link to {{ "index.xml" | relURL }}
because I want the link to work on sub pages.
Would be nice if Hugo would take care of this though.
This issue has been automatically marked as stale because it has not been commented on for at least four months.
The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.
This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.
Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.
If this is a bug and you can still reproduce this error on the latest release
or the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
The behaviour here is as designed.
Now RSSLink
will only return the link for pages that potentially have a RSS feed (it may be turned off, and RSSLink
will still create a link in that case).
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I seem to have run into a bug with the combination of
.RSSLink
and use of the permalinks feature. I have the following in myconfig.toml
:I'm using a minor variant of the standard hyde template, which contains this in its
layouts/chrome/head.html
file:When I look at the HTML generated for one of my posts, however, I see:
Note that the
href
attribute has no value. I see proper links when I use.RSSLink
in the sidebar (though there I run into #467). The full blog source is here. Let me know if I can provide further details. And thanks so much for building hugo!