File tree 2 files changed +40
-0
lines changed 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \View \Components ;
4
+
5
+ use Illuminate \View \Component ;
6
+
7
+ class MetaNoIndex extends Component
8
+ {
9
+ /**
10
+ * Current domain to compare against.
11
+ *
12
+ * @var string
13
+ */
14
+ public string $ expectedDomain ;
15
+
16
+ public function __construct ()
17
+ {
18
+ $ this ->expectedDomain = parse_url (config ('app.url ' ), PHP_URL_HOST );
19
+ }
20
+
21
+ /**
22
+ * Check if the current URL matches the expected one.
23
+ */
24
+ public function shouldRender (): bool
25
+ {
26
+ $ currentDomain = parse_url (request ()->fullUrl (), PHP_URL_HOST );
27
+
28
+ return $ currentDomain !== $ this ->expectedDomain ;
29
+ }
30
+
31
+ /**
32
+ * Get the view / contents that represent the component.
33
+ */
34
+ public function render ()
35
+ {
36
+ return '<meta name="robots" content="noindex, nofollow"> ' ;
37
+ }
38
+ }
Original file line number Diff line number Diff line change 39
39
image =" {!! route (' cover' , [' text' => View:: getSection (' cover' ) ?? View:: getSection (' title' , config (' site.description' ))]) ! !}"
40
40
{{-- csp="*.laravel.su *.gravatar.com *.githubusercontent.com" --}} />
41
41
42
+ <x-meta-no-index />
43
+
42
44
<link rel =" preconnect" href =" https://fonts.googleapis.com" >
43
45
<link rel =" preconnect" href =" https://fonts.gstatic.com" crossorigin >
44
46
<link href =" https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap"
You can’t perform that action at this time.
0 commit comments