RSS page for tags (and other pages)

Matt Mackall mpm at selenic.com
Mon Dec 3 12:58:59 CST 2012


On Sun, 2012-12-02 at 23:31 +0100, Angel Ezquerra wrote:
> On Fri, Nov 30, 2012 at 11:32 PM, Matt Mackall <mpm at selenic.com> wrote:
> > On Fri, 2012-11-30 at 22:54 +0100, Angel Ezquerra wrote:
> >> On Fri, Nov 30, 2012 at 8:15 PM, Matt Mackall <mpm at selenic.com> wrote:
> >> > On Fri, 2012-11-30 at 00:37 +0100, Angel Ezquerra wrote:
> >> >> On Thu, Nov 29, 2012 at 8:53 PM, Matt Mackall <mpm at selenic.com> wrote:
> >> >> > On Thu, 2012-11-29 at 17:55 +0100, Angel Ezquerra wrote:
> >> >> >> Hi,
> >> >> >>
> >> >> >> today, playing around with the rss web.style I noticed that it is
> >> >> >> possible for hgweb to generate an RSS feed that only shows the tagged
> >> >> >> the revisions for example, if you select the "rss" style.
> >> >> >>
> >> >> >> However, if you click on the RSS or Atom button that is located on the
> >> >> >> tags page you get an RSS feed of all the revisions, not of the tagged
> >> >> >> revisions as could be expected. That button links to {url}rss-log. I
> >> >> >> tried manually going to {url}rss-log/tags or even {url}/tags/rss-log
> >> >> >> but that does not work.
> >> >> >>
> >> >> >> I looked for "rss-log" on the mercurial source code but I did not find
> >> >> >> any references to it except on the template files. I'd like to fix
> >> >> >> this issue since I think it would be nice to be able to "subscribe" to
> >> >> >> a tag page and get notifications whenever someone adds a new tag, for
> >> >> >> example. You could even suscribe to a file and be notified when the
> >> >> >> file is modified, etc, which I think would be really powerful.
> >> >> >>
> >> >> >> Does someone have an idea of where is the "rss-log" handled?
> >> >> >> Alternatively, is there a way to ask the web server to serve a page as
> >> >> >> if the "rss" web style had been selected?
> >> >> >
> >> >> > Internally, hgweb has no special support for RSS. It's simply a style.
> >> >> > The rss-log/ link is in the form [<style>-]<page>/.
> >> >> >
> >> >> > Implementing RSS for tags is probably a matter of copying
> >> >> > templates/rss/log.tmpl to tags.tmpl, fixing it up, and editing the other
> >> >> > templates that link to it. Same for atom. Consult paper/tags.tmpl to see
> >> >> > what sort of data is available in the tags page context.
> >> >>
> >> >> Thank you Matt,
> >> >>
> >> >> I was not aware of the "[<style>-]<page>" syntax, which is great.
> >> >>
> >> >> One problem that I see is that the RSS and Atom links are created by
> >> >> the footer template, which is not aware (AFAIK) of the name of the
> >> >> current file (i.e. whether it is the "log", "tags" or "bookmarks"
> >> >> page, for example). Is there some way to pass that information to the
> >> >> footer.tmpl when it is inserted on tags.tmpl for example?
> >> >
> >> > I see. You're probably looking at the gitweb style.
> >> >
> >> > As it happens, the standard style (paper) already has tags RSS support:
> >> >
> >> > http://www.selenic.com/hg/tags
> >> >
> >> > ..and has since it was introduced in 2008.
> >> >
> >>
> >> Sorry Matt, but I don't understand what you mean.
> >>
> >> The paper style does not have any RSS or Atom links as far as I can
> >> see.
> >
> > What browser are you using? Does it have 'view source'?
> >
> > Here's the file I asked you to look at in my first response:
> >
> > http://www.selenic.com/hg/file/e853d27956fb/mercurial/templates/paper/tags.tmpl#l6
> >
> 
> I'm using the latest firefox version. The lines you point me to are
> the ones that creates a couple of feed "links". In the past I believe
> Firefox would show an icon on the address bar whenever this sort of
> rss link was found on the page, but that is not the case anymore. In
> order to subscribe to those links you must go to the "bookmarks /
> subscribe to this page" menu.
> 
> Once you know the RSS links are there I guess this is fine, but it is
> not very discoverable IMHO. However a bigger problem is that for those
> styles that do show an RSS and Atom button, such as monoblue and
> gitweb, those buttons link to different feeds that the (hidden) RSS
> "links" we discussed above.
> 
> Instead I'd like the RSS and Atom buttons to link to the very same RSS
> feeds as those links do. In order to do so I should either pass some
> info to the footer template (assuming that is possible) or moving the
> RSS and Atom buttons from the footer and into the tags, bookmarks, etc
> templates. This is doable but seems that it will result in a bit of
> repeated template code so I'd like to avoid it if possible.

My point of continually pointing you back to the paper theme is to show
you how things ought to work. Paper is the default theme; gitweb is a
theme I would delete if I could. Forget the footer approach, it's
obviously broken precisely because it's not page-specific. Instead, do
it like paper: put the links in the per-page templates.

It seems the trend of having RSS buttons automatically in the search bar
has reversed lately, so it makes sense to start putting feed links back
in the page body. But that's a different topic.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list