Bläddra i källkod

Change rel attribute for user links

https://developers.google.com/search/docs/advanced/appearance/qualify-outbound-links
Visman 4 år sedan
förälder
incheckning
fc686720b7

+ 1 - 0
app/Models/Pages/Profile/View.php

@@ -177,6 +177,7 @@ class View extends Profile
                 'caption' => __('Website'),
                 'value'   => $this->curUser->censorUrl,
                 'href'    => $this->curUser->censorUrl,
+                'rel'     => 'ugc',
             ];
         }
         if (! empty($fields)) {

+ 2 - 2
app/config/defaultBBCode.php

@@ -336,7 +336,7 @@ if ($parser->attr('isSign')) {
     }
 }
 
-return '<a href="' . $body . '" rel="nofollow">&lt;' . __('Image link') . ' - ' . $attrs['Def'] . '&gt;</a>';
+return '<a href="' . $body . '" rel="ugc">&lt;' . __('Image link') . ' - ' . $attrs['Def'] . '&gt;</a>';
 HANDLER,
     ],
     [
@@ -384,7 +384,7 @@ if ($url === $body) {
     $body = $parser->e($url);
 }
 
-return "<a href=\"{$fUrl}\" rel=\"nofollow\">{$body}</a>";
+return "<a href=\"{$fUrl}\" rel=\"ugc\">{$body}</a>";
 HANDLER,
     ],
     [

+ 1 - 1
app/templates/layouts/form.forkbb.php

@@ -101,7 +101,7 @@
                 @elseif ('str' === $cur['type'])
                 <p class="f-str" id="id-{{ $key }}"> @if ($cur['html']){!! $cur['value'] !!} @else{{ $cur['value'] }} @endif</p>
                 @elseif ('link' === $cur['type'])
-                <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
+                <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" @if (isset($cur['rel'])) rel="{{ $cur['rel'] }}" @endif title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
                 @elseif ('yield' === $cur['type'])
                 {!! $this->block($cur['value']) !!}
                 @elseif ('file' === $cur['type'])