Skip to content

Commit 53c8412

Browse files
Add follow/nofollow attribute control for web links
1 parent ef1d550 commit 53c8412

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/administrator/components/com_weblinks/forms/weblink.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@
234234
name="jbasic"
235235
label="COM_WEBLINKS_FIELDSET_OPTIONS"
236236
>
237+
<field
238+
name="follow"
239+
type="list"
240+
label="COM_WEBLINKS_FIELD_FOLLOW_LABEL"
241+
default="nofollow"
242+
>
243+
<option value="follow">COM_WEBLINKS_FIELD_VALUE_FOLLOW</option>
244+
<option value="nofollow">COM_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
245+
</field>
246+
237247
<field
238248
name="target"
239249
type="list"

src/administrator/language/en-GB/com_weblinks.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Category Tags"
4848
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Tags"
4949
COM_WEBLINKS_FIELD_TARGET_DESC="Target browser window when the link is selected."
5050
COM_WEBLINKS_FIELD_TARGET_LABEL="Target"
51+
COM_WEBLINKS_FIELD_FOLLOW_LABEL="Follow/No Follow"
52+
COM_WEBLINKS_FIELD_VALUE_FOLLOW="Follow"
53+
COM_WEBLINKS_FIELD_VALUE_NOFOLLOW="No Follow"
5154
COM_WEBLINKS_FIELD_URL_LABEL="URL"
5255
COM_WEBLINKS_FIELD_VALUE_REPORTED="Reported"
5356
COM_WEBLINKS_FIELD_VERSION_LABEL="Revision"

src/components/com_weblinks/tmpl/category/default_items.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@
129129
switch ($item->params->get('target', $this->params->get('target'))) {
130130
case 1:
131131
// Open in a new window
132-
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
133-
$this->escape($item->title) . '</a>';
132+
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '"
133+
rel="' . $item->params->get('follow', 'follow') . '">'
134+
. $this->escape($item->title) . '</a>';
134135

135136
break;
136137
case 2:
@@ -157,8 +158,9 @@
157158
break;
158159
default:
159160
// Open in parent window
160-
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
161-
$this->escape($item->title) . ' </a>';
161+
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '"
162+
rel="' . $item->params->get('follow', 'follow') . '">'
163+
. $this->escape($item->title) . '</a>';
162164

163165
break;
164166
}

src/components/com_weblinks/tmpl/weblink/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
<div itemprop="articleBody">
5353
<div class="p-3">
54-
<a href="<?php echo $weblinkUrl; ?>" target="_blank" itemprop="url">
54+
<a href="<?php echo $weblinkUrl; ?>" target="_blank" rel="<?php echo $this->params->get('follow', 'follow'); ?>" itemprop="url">
5555
<?php echo $weblinkUrl; ?>
5656
</a>
5757
</div>

0 commit comments

Comments
 (0)