Keyword

rel="nofollow" in Extra Field Links

  • Daniel Bacher
  • Daniel Bacher's Avatar Topic Author
  • Offline
  • New Member
More
13 years 11 months ago #89989 by Daniel Bacher
rel="nofollow" in Extra Field Links was created by Daniel Bacher
I don't know if anyone is interested in this article, but i use K2 as a Portfolio Component and there i had one problem, i don't want Google to follow the links when i add the URL in the Extra Field Links. 
Here is a Workaround so you can choose the rel tag nofollow in the dropdown:

Step 1:

Open the file: /administrator/components/com_k2/models/extrafields.php
around line 234 add this code:

$targetOptions[]=JHTML::_('select.option', 'nofollow', JText::_('No follow'));

Step 2:
Open the file: /administrator/components/com_k2/views/extrafield/tmpl/default.php
around line 125 add this code:

var option = new Element('option',{'value':'nofollow'}).setHTML('<?php echo JText::_('No Follow', true); ?>').injectInside(select);

and around line 142 add this code:

options[4] = new Element('option',{'value':'nofollow'}).setHTML('<?php echo JText::_('No Follow', true); ?>').injectInside(select);

Step 3:

Open the file: /components/com_k2/models/item.php

around line 879 add this code:

case 'nofollow':
$attributes='rel="nofollow"';
break;


DONE.

SEE THE SCREENSHOTS FOR FURTHER DETAILS.

Now you can choose in Extra Fields the nofollow in the Link Dropdown.
Attachments:

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #89990 by Dimitris Trikkas
Replied by Dimitris Trikkas on topic rel="nofollow" in Extra Field Links
Thank you for the tip. But it would be better if there was a way to use the "nofollow" with tha option of opening the link always in a new window (not in the same, because the visitors are living the site) !!

 

Thank you anyway! It was very good!

Please Log in or Create an account to join the conversation.

  • Daniel Bacher
  • Daniel Bacher's Avatar Topic Author
  • Offline
  • New Member
More
13 years 8 months ago #89991 by Daniel Bacher
Replied by Daniel Bacher on topic rel="nofollow" in Extra Field Links
in step 3 add:  

$attributes='rel="nofollow" target="_blank"'; 

instead of $attributes='rel="nofollow"';


this should work

 


Dimitris Trikkas said:

Thank you for the tip. But it would be better if there was a way to use the "nofollow" with tha option of opening the link always in a new window (not in the same, because the visitors are living the site) !!

 

Thank you anyway! It was very good!

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #89992 by prosper win
Replied by prosper win on topic rel="nofollow" in Extra Field Links
Step 1:
Open the file: /administrator/components/com_k2/models/extrafields.php

 

change extrafields.php to extrafield.php 

 

 

Thank you very much for good instruction. It's work!

Please Log in or Create an account to join the conversation.

More
12 years 5 days ago #89993 by Andreas
Replied by Andreas on topic Re: rel="nofollow" in Extra Field Links
Anyone know how to do this on K2 ver. 2.5.4?

Please Log in or Create an account to join the conversation.

  • Chrissovalantis Zervas
  • Chrissovalantis Zervas's Avatar
  • Offline
  • New Member
More
6 years 6 months ago #166869 by Chrissovalantis Zervas
Replied by Chrissovalantis Zervas on topic Re: rel="nofollow" in Extra Field Links
On step 2, it must be
<script>var option = new Element('option',{'value':'nofollow'}).setHTML('<?php echo JText::_('No Follow', true); ?>').injectInside(select);</script>
and
<script>options[4] = new Element('option',{'value':'nofollow'}).setHTML('<?php echo JText::_('No Follow', true); ?>').injectInside(select);</script>
Also, in K2 v8 step 3 is around line 1537.

Anyway, many thanks for that workaround! Great job!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 6 months ago #166881 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: rel="nofollow" in Extra Field Links
This is a really old post but nice to hear that these solution still apply.
You can also render each field separately so you can have the markup you want.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum