- Posts: 2
COMMUNITY FORUM
rel="nofollow" in Extra Field Links
- Daniel Bacher
- Topic Author
- Offline
- New Member
Less
More
14 years 1 month 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.
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.
Please Log in or Create an account to join the conversation.
- Dimitris Trikkas
- Offline
- New Member
Less
More
- Posts: 1
13 years 11 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!
Thank you anyway! It was very good!
Please Log in or Create an account to join the conversation.
- Daniel Bacher
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
13 years 11 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!
$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.
- prosper win
- Offline
- New Member
Less
More
- Posts: 2
13 years 6 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!
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.
- Andreas
- Offline
- New Member
Less
More
- Posts: 1
12 years 2 months 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
- Offline
- New Member
Less
More
- Posts: 13
6 years 8 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!
<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
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 8 months ago #166881
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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.
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.