Ver código fonte

Move the formation of canonical and robots to templates

Visman 2 anos atrás
pai
commit
046c1dbe92

+ 0 - 14
app/Models/Page.php

@@ -356,20 +356,6 @@ abstract class Page extends Model
      */
     protected function getpageHeaders(): array
     {
-        if ($this->canonical) {
-            $this->pageHeader('canonical', 'link', 0, [
-                'rel'  => 'canonical',
-                'href' => $this->canonical,
-            ]);
-        }
-
-        if ($this->robots) {
-            $this->pageHeader('robots', 'meta', 11000, [
-                'name'    => 'robots',
-                'content' => $this->robots,
-            ]);
-        }
-
         if (1 === $this->user->g_search) {
             $this->pageHeader('opensearch', 'link', 0, [
                 'rel'   => 'search',

+ 1 - 0
app/templates/layouts/install.forkbb.php

@@ -4,6 +4,7 @@
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>{!! __('ForkBB Installation') !!}</title>
+  <meta name="robots" content="noindex">
 @foreach ($p->pageHeaders as $pageHeader)
     @if ('style' === $pageHeader['type'])
   <style>{!! $pageHeader['values'][0] !!}</style>

+ 6 - 0
app/templates/layouts/main.forkbb.php

@@ -7,6 +7,12 @@
 @if ($p->mDescription)
   <meta name="description" content="{{! $p->mDescription !}}">
 @endif
+@if ($p->robots)
+  <meta name="robots" content="{{ $p->robots }}">
+@endif
+@if ($p->canonical)
+  <link rel="canonical" href="{{ $p->canonical }}">
+@endif
 @foreach ($p->pageHeaders as $pageHeader)
     @if ('style' === $pageHeader['type'])
   <style>{!! $pageHeader['values'][0] !!}</style>

+ 1 - 0
app/templates/layouts/redirect.forkbb.php

@@ -8,6 +8,7 @@
 @if ($p->mDescription)
   <meta name="description" content="{{! $p->mDescription !}}">
 @endif
+  <meta name="robots" content="noindex">
 @foreach ($p->pageHeaders as $pageHeader)
     @if ('style' === $pageHeader['type'])
   <style>{!! $pageHeader['values'][0] !!}</style>