[xwiki-users] Open RSS feed links in new window
Hi all, While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window? I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so. I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either. Is it possible, and if yes, how? Thanx in advance, Wouter
Hi Wouter, On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though. Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks. It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering. Otherwise you could create a jira issue to request this feature. Thanks -Vincent
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation. Thanks -Vincent PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
On Sep 23, 2011, at 2:44 PM, Vincent Massol wrote:
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation.
Some doc: http://rendering.xwiki.org/xwiki/bin/view/Main/Extending#HAddinganewTransfor... -Vincent
Thanks -Vincent
PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
Hi Vincent, Thanx for the feedback, I will spend some time on trying this out, its new for me but of interest definately! Another issue with the rss feed, is there a possibility to show this in a panel? Since then my users can just move their heads to the left and see the panel getting updated with the feed, and dont need to go to a page to do so. Is this possible at all? Would be a nice feature, if its not possible yet, I know, I go and make Jira issues :-) Thanx, Wouter On Fri, Sep 23, 2011 at 2:44 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation.
Thanks -Vincent
PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Sep 23, 2011, at 3:39 PM, Wouter de Vos wrote:
Hi Vincent,
Thanx for the feedback, I will spend some time on trying this out, its new for me but of interest definately! Another issue with the rss feed, is there a possibility to show this in a panel? Since then my users can just move their heads to the left and see the panel getting updated with the feed, and dont need to go to a page to do so. Is this possible at all?
Sure, just put the rss macro in a panel… Thanks -Vincent
Would be a nice feature, if its not possible yet, I know, I go and make Jira issues :-)
Thanx,
Wouter
On Fri, Sep 23, 2011 at 2:44 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation.
Thanks -Vincent
PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 23/9/2011 5:57 PM, Vincent Massol wrote: > On Sep 23, 2011, at 3:39 PM, Wouter de Vos wrote: > >> Hi Vincent, >> >> Thanx for the feedback, I will spend some time on trying this out, its new >> for me but of interest definately! >> Another issue with the rss feed, is there a possibility to show this in a >> panel? Since then my users can just move their heads to the left and see the >> panel getting updated with the feed, and dont need to go to a page to do so. >> Is this possible at all? > Sure, just put the rss macro in a panel… > > Thanks > -Vincent > >> Would be a nice feature, if its not possible yet, I know, I go and make Jira >> issues :-) >> >> Thanx, >> >> Wouter >> >> On Fri, Sep 23, 2011 at 2:44 PM, Vincent Massol<[email protected]> wrote: >> >>> On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote: >>> >>>> Hi Wouter, >>>> >>>> On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote: >>>> >>>>> Hi all, >>>>> >>>>> While gathering information on the simplify my wiki subject, I stumbled >>> upon >>>>> the RSS makro and tried it out, works great. >>>>> But is there a way to have the RSS Links that the RSS Makro displays >>> open in >>>>> a new window? >>>>> >>>>> I know there are discussions on the sensibility of opening links in a >>> new >>>>> window, but in this project I will have to do so. >>>>> >>>>> I tried putting rel="blank" in somewhere, but nothing worked. >>>>> I tried putting a java class objekt in, but I guess since the rss feed >>> is in >>>>> a makro, this did not work either. >>>>> >>>>> Is it possible, and if yes, how? >>>> Right now this feature is not part of the RSS macro. It could be >>> interesting to add it though. >>>> Now we could imagine some workaround but they require a bit of work. >>> Basically: >>>> * create a wiki macro with the same name "rss" >>>> * In the content of this wiki macro, use Groovy to lookup the original >>> rss macro, execute it, then get its XDOM and find all LinkBlocks, then add >>> rel="blank" in those blocks. >>>> It's only about 6-7 lines of groovy script in total but it may be easy or >>> hard depending on your current knowledge of xwiki components/rendering. >>> >>> Actually a slightly cleaner version is simply to write a Transformation >>> (since this is what it's for! :)). So you don't need to overwrite the wiki >>> macro. All you need is to add a new Transformation. >>> >>> Thanks >>> -Vincent >>> >>> PS to self: we really need to add wiki components since adding a >>> transformation is a nice use case for it. >>> >>>> Otherwise you could create a jira issue to request this feature. >>>> >>>> Thanks >>>> -Vincent >>> _______________________________________________ >>> users mailing list >>> [email protected] >>> http://lists.xwiki.org/mailman/listinfo/users >>> >> _______________________________________________ >> users mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users Hi Wouter, Vincent's solution is the most correct one from the Java development and best practice point of view. But for some less experienced developers it might be a bit difficult imho. So I can think of a way to work around this (i.e. do a quick dirty fix). An easier solution, though not the most elegant one, would be to write a piece of Javascript code to be executed on page load. It should search fpr links in the RSS block(s) and write the "rel" or "target" attribute to "_blank". The only problem is that you should include that script via xwiki.jsx.use(...) on each page you want this feature on. The Javascript could look something like this: document.observe("xwiki:dom:loaded") { var rssLinks = $$('.rssitemtitle a'); //the css selector for links in the 'div's generated by the {{rss}} macro. rssLinks.each(function(link){ link.writeAttribute('target', '_blank'); }); } I hope it helps. Cheers! Stefan.
Hi Stefan! I played around with your solution and got it working just fine! I created a Objekt - Java Extension on the page where I have the rss makro and placed your script: { var rssLinks = $$('.rssitemtitle a'); //the css selector for links in the 'div's generated by the {{rss}} macro. rssLinks.each(function(link){ link.writeAttribute('target', '_blank'); }); } in there, and now it works just fine. I still think it is a nice option to have within the makro and will try and post a Jira accordingly. Thanks for all the help, Wouter
Hi Wouter,
Vincent's solution is the most correct one from the Java development and best practice point of view. But for some less experienced developers it might be a bit difficult imho. So I can think of a way to work around this (i.e. do a quick dirty fix). An easier solution, though not the most elegant one, would be to write a piece of Javascript code to be executed on page load. It should search fpr links in the RSS block(s) and write the "rel" or "target" attribute to "_blank". The only problem is that you should include that script via xwiki.jsx.use(...) on each page you want this feature on.
The Javascript could look something like this:
document.observe("xwiki:dom:loaded") { var rssLinks = $$('.rssitemtitle a'); //the css selector for links in the 'div's generated by the {{rss}} macro. rssLinks.each(function(link){ link.writeAttribute('target', '_blank'); }); }
I hope it helps. Cheers! Stefan. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi Vincent, One last on RSS, I am trying it in Panel this time, the Panel code looks like this: #panelheader ($'RSS') {{rss feed="http://feeds.feedburner.com/massol" content="true" image="true" count="2" /}} #panelfooter() And then I get a panel with the header OK, but the content just shows {{rss feed="http://feeds.feedburner.com/massol" content="true" image="true" count="2" /}} I put the exact same code on a page and there it works fine, do I have to put more code around it? I tried putting #Macro (RSS Macro) in front, but got some error message: Failed to evaluate content with id RSS Feeds What am I missing? Why does it work on a page but not in a panel? Thanx again, Wouter On Fri, Sep 23, 2011 at 4:57 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 3:39 PM, Wouter de Vos wrote:
Hi Vincent,
Thanx for the feedback, I will spend some time on trying this out, its new for me but of interest definately! Another issue with the rss feed, is there a possibility to show this in a panel? Since then my users can just move their heads to the left and see the panel getting updated with the feed, and dont need to go to a page to do so. Is this possible at all?
Sure, just put the rss macro in a panel…
Thanks -Vincent
Would be a nice feature, if its not possible yet, I know, I go and make Jira issues :-)
Thanx,
Wouter
On Fri, Sep 23, 2011 at 2:44 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation.
Thanks -Vincent
PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi, On Sep 27, 2011, at 1:48 PM, Wouter de Vos wrote:
Hi Vincent,
One last on RSS, I am trying it in Panel this time, the Panel code looks like this:
#panelheader ($'RSS')
This is xwiki 1.0 syntax
{{rss feed="http://feeds.feedburner.com/massol" content="true" image="true" count="2" /}}
This is XWiki 2.0 syntax. You need to write XWiki 2.0 syntax for your panel. Thanks -Vincent
#panelfooter()
And then I get a panel with the header OK, but the content just shows
{{rss feed="http://feeds.feedburner.com/massol" content="true" image="true" count="2" /}}
I put the exact same code on a page and there it works fine, do I have to put more code around it?
I tried putting #Macro (RSS Macro) in front, but got some error message: Failed to evaluate content with id RSS Feeds What am I missing? Why does it work on a page but not in a panel?
Thanx again,
Wouter
On Fri, Sep 23, 2011 at 4:57 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 3:39 PM, Wouter de Vos wrote:
Hi Vincent,
Thanx for the feedback, I will spend some time on trying this out, its new for me but of interest definately! Another issue with the rss feed, is there a possibility to show this in a panel? Since then my users can just move their heads to the left and see the panel getting updated with the feed, and dont need to go to a page to do so. Is this possible at all?
Sure, just put the rss macro in a panel…
Thanks -Vincent
Would be a nice feature, if its not possible yet, I know, I go and make Jira issues :-)
Thanx,
Wouter
On Fri, Sep 23, 2011 at 2:44 PM, Vincent Massol <[email protected]> wrote:
On Sep 23, 2011, at 2:40 PM, Vincent Massol wrote:
Hi Wouter,
On Sep 23, 2011, at 2:21 PM, Wouter de Vos wrote:
Hi all,
While gathering information on the simplify my wiki subject, I stumbled upon the RSS makro and tried it out, works great. But is there a way to have the RSS Links that the RSS Makro displays open in a new window?
I know there are discussions on the sensibility of opening links in a new window, but in this project I will have to do so.
I tried putting rel="blank" in somewhere, but nothing worked. I tried putting a java class objekt in, but I guess since the rss feed is in a makro, this did not work either.
Is it possible, and if yes, how?
Right now this feature is not part of the RSS macro. It could be interesting to add it though.
Now we could imagine some workaround but they require a bit of work. Basically: * create a wiki macro with the same name "rss" * In the content of this wiki macro, use Groovy to lookup the original rss macro, execute it, then get its XDOM and find all LinkBlocks, then add rel="blank" in those blocks.
It's only about 6-7 lines of groovy script in total but it may be easy or hard depending on your current knowledge of xwiki components/rendering.
Actually a slightly cleaner version is simply to write a Transformation (since this is what it's for! :)). So you don't need to overwrite the wiki macro. All you need is to add a new Transformation.
Thanks -Vincent
PS to self: we really need to add wiki components since adding a transformation is a nice use case for it.
Otherwise you could create a jira issue to request this feature.
Thanks -Vincent
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
Stefan Leon Orzu -
Vincent Massol -
Wouter de Vos