You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by PXZ <pr...@gmail.com> on 2011/06/15 12:35:14 UTC

ActionLink not Search Engine safe?

hi, I'm new to Tapestry. I was trying out the Vote Youtube tutorial/video,
and looks like that ActionLink doesn't seem to be safe for search engines?

The ActionLinks are rendered like this:

/vote/index.vote/2 + 

Or when zone (Ajax) is disabled:

/vote/index.vote/2 + 


The problem with this code is that the link changes server sided database
state via a simple link click (so it's a non-idempotent request). This means
that search engines and bots will change the database when they crawl/index
the website. The positive side of this code is that it is a safety fallback
for non-javascript clients.

Is there a way to override the href attribute to "#" so that it is safe for
search engines? Or is their another Tapestry component that is better suited
for this problem?


--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4490777.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by Taha Hafeez <ta...@gmail.com>.
You have to set the zone parameter of the enclosing form component for
ajax submission



On Sun, Jul 31, 2011 at 7:24 PM, PXZ <pr...@gmail.com> wrote:
>
> Taha Hafeez wrote:
>>
>> Such links are submit links. Such a link has href='#' and submit form
>> using javascript. As search engines follow href and don't execute
>> javascript, these links are never followed.
>>
>> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/LinkSubmit.html
> Thanks for the info.
> Is a LinkSubmit able to perform ajax calls? (I have searched for whether it
> supports ajax, but couldn't find it.)
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4652006.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by PXZ <pr...@gmail.com>.
Taha Hafeez wrote:
> 
> Such links are submit links. Such a link has href='#' and submit form
> using javascript. As search engines follow href and don't execute
> javascript, these links are never followed.
> 
> http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/LinkSubmit.html
Thanks for the info.
Is a LinkSubmit able to perform ajax calls? (I have searched for whether it
supports ajax, but couldn't find it.)


--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4652006.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by Taha Hafeez <ta...@gmail.com>.
Such links are submit links. Such a link has href='#' and submit form
using javascript. As search engines follow href and don't execute
javascript, these links are never followed.

http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/LinkSubmit.html

regards
Taha

On Sun, Jul 31, 2011 at 4:02 PM, PXZ <pr...@gmail.com> wrote:
>
> Taha Hafeez wrote:
>>
>> A link can be used for updates. As a developer it is our responsibility to
>> ensure that such a link is only available to properly authenticated users.
> And what if the link action should be available for publicly
> non-authenticated users? For example a blogging website where everybody can
> post comments. Than actionlinks cannot be used.
>
> There no easy solution in Tapestry to solve this :(
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4651671.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 01 Aug 2011 14:15:43 -0300, PXZ <pr...@gmail.com> wrote:

> I have found a solution by making a custom link component in this way:
> Merge the sourcecode of the following classes: AbstractLink,
> AbstractComponentEventLink and ActionLink. Then modify the buildHref()
> method so that it simply returns "#". Then you can use your custom  
> component instead of the core ActionLink.

Why don't you just subclass AbstractLink? No need to copy sources here.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by PXZ <pr...@gmail.com>.
I have found a solution by making a custom link component in this way:

Merge the sourcecode of the following classes: AbstractLink,
AbstractComponentEventLink and ActionLink. Then modify the buildHref()
method so that it simply returns "#". Then you can use your custom component
instead of the core ActionLink.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4655695.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by PXZ <pr...@gmail.com>.
dragan.sahpaskix@gmail.com wrote:
> 
> One solution is to check the user-agent header. Here is a list of common
> user agents http://www.robotstxt.org/db.html.
That could work, but it's not an option for me, because other unknown bots
that mimic the browsers agent might cause problems.

Taha Hafeez wrote:
> You have to set the zone parameter of the enclosing form component for
> ajax submission
ActionLink doesn't require forms, but LinkSubmit unfortunately does. (I
don't need forms.)

I also tried making a custom component by extending ActionLink and
overriding the href writing element, but Tapestry seems to shield developers
from extending its components by making the writeLink method (in
AbstractLink) final.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4653448.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by "dragan.sahpaskix@gmail.com" <dr...@gmail.com>.
On Sun, Jul 31, 2011 at 12:32 PM, PXZ <pr...@gmail.com> wrote:

>
> Taha Hafeez wrote:
> >
> > A link can be used for updates. As a developer it is our responsibility
> to
> > ensure that such a link is only available to properly authenticated
> users.
> And what if the link action should be available for publicly
> non-authenticated users? For example a blogging website where everybody can
> post comments. Than actionlinks cannot be used.
>

As Thiago said, you (the developer) are responsible of doing this.
One solution is to check the user-agent header. Here is a list of common
user agents http://www.robotstxt.org/db.html.
You can get the user-agent header by injecting the Reqest in your page

@Inject
private Request request;

and use
String getHeader(String name);

Also you can see all headers using  List<String> getHeaderNames();

Cheers,
Dragan Sahpaski

>
> There no easy solution in Tapestry to solve this :(
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4651671.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: ActionLink not Search Engine safe?

Posted by PXZ <pr...@gmail.com>.
Taha Hafeez wrote:
> 
> A link can be used for updates. As a developer it is our responsibility to
> ensure that such a link is only available to properly authenticated users.
And what if the link action should be available for publicly
non-authenticated users? For example a blogging website where everybody can
post comments. Than actionlinks cannot be used.

There no easy solution in Tapestry to solve this :(

--
View this message in context: http://tapestry.1045711.n5.nabble.com/ActionLink-not-Search-Engine-safe-tp4490777p4651671.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by Taha Tapestry <ta...@gmail.com>.
A link can be used for updates. As a developer it is our responsibility to ensure that such a link is only available to properly authenticated users.

Regards
Taha

Sent from my iPhone

On Jun 15, 2011, at 5:24 PM, "Thiago H. de Paula Figueiredo" <th...@gmail.com> wrote:

> On Wed, 15 Jun 2011 07:35:14 -0300, PXZ <pr...@gmail.com> wrote:
> 
>> hi, I'm new to Tapestry.
> 
> Welcome!
> 
>> I was trying out the Vote Youtube tutorial/video,
>> and looks like that ActionLink doesn't seem to be safe for search engines?
> 
>> The problem with this code is that the link changes server sided database
>> state via a simple link click (so it's a non-idempotent request). This means that search engines and bots will change the database when they crawl/index the website. The positive side of this code is that it is a safety fallback for non-javascript clients.
> 
> Your concern is correct, but IMHO this is something that should be handled by the developer, not by the framework itself. You are responsible for checking if the action requested can be done or not. You can check some logic in your page or component class before doing the action itself.
> 
>> Is there a way to override the href attribute to "#" so that it is safe for search engines?
> 
> You can write a mixin or a MarkupRendererFilter for that.
> 
>> Or is their another Tapestry component that is better suited for this problem?
> 
> No. But I think EventLink should be used instead of ActionLink anyway. An ActionLink is basically an EventLink which always trigger the 'action' event.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: ActionLink not Search Engine safe?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 15 Jun 2011 07:35:14 -0300, PXZ <pr...@gmail.com> wrote:

> hi, I'm new to Tapestry.

Welcome!

> I was trying out the Vote Youtube tutorial/video,
> and looks like that ActionLink doesn't seem to be safe for search  
> engines?

> The problem with this code is that the link changes server sided database
> state via a simple link click (so it's a non-idempotent request). This  
> means that search engines and bots will change the database when they  
> crawl/index the website. The positive side of this code is that it is a  
> safety fallback for non-javascript clients.

Your concern is correct, but IMHO this is something that should be handled  
by the developer, not by the framework itself. You are responsible for  
checking if the action requested can be done or not. You can check some  
logic in your page or component class before doing the action itself.

> Is there a way to override the href attribute to "#" so that it is safe  
> for search engines?

You can write a mixin or a MarkupRendererFilter for that.

> Or is their another Tapestry component that is better suited for this  
> problem?

No. But I think EventLink should be used instead of ActionLink anyway. An  
ActionLink is basically an EventLink which always trigger the 'action'  
event.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org