Skip to content

Commit fad815b

Browse files
committed
try to fix load from meta crawler as it tries all combination of filters + sort + pagination
1 parent 743fae3 commit fad815b

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

templates/Packages/index.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ class="packages index content"
108108
<div class="join">
109109
<?php
110110
$this->Paginator->setTemplates([
111-
'sort' => '<a href="{{url}}" class="join-item btn btn-sm">{{text}}</a>',
112-
'sortAsc' => '<a href="{{url}}" class="join-item btn btn-sm btn-primary gap-2" aria-sort="ascending">{{text}}<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 15-6-6-6 6"/></svg></a>',
113-
'sortDesc' => '<a href="{{url}}" class="join-item btn btn-sm btn-primary gap-2" aria-sort="descending">{{text}}<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></a>',
111+
'sort' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm">{{text}}</a>',
112+
'sortAsc' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm btn-primary gap-2" aria-sort="ascending">{{text}}<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 15-6-6-6 6"/></svg></a>',
113+
'sortDesc' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm btn-primary gap-2" aria-sort="descending">{{text}}<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></a>',
114114
]);
115115
?>
116116
<?= $this->Paginator->sort('downloads', 'Downloads', ['direction' => 'desc']) ?>
@@ -142,14 +142,14 @@ class="packages index content"
142142
<div class="flex justify-center px-4 py-8 sm:px-6 lg:px-8">
143143
<?php
144144
$this->Paginator->setTemplates([
145-
'number' => '<a href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
145+
'number' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
146146
'current' => '<button type="button" class="join-item btn btn-sm btn-active sm:btn-md" aria-current="page">{{text}}</button>',
147147
'ellipsis' => '<span class="join-item btn btn-sm btn-disabled sm:btn-md">{{text}}</span>',
148-
'first' => '<a href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
149-
'last' => '<a href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
150-
'prevActive' => '<a rel="prev" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
148+
'first' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
149+
'last' => '<a rel="nofollow" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
150+
'prevActive' => '<a rel="prev nofollow" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
151151
'prevDisabled' => '<span class="join-item btn btn-sm btn-disabled sm:btn-md">{{text}}</span>',
152-
'nextActive' => '<a rel="next" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
152+
'nextActive' => '<a rel="next nofollow" href="{{url}}" class="join-item btn btn-sm sm:btn-md">{{text}}</a>',
153153
'nextDisabled' => '<span class="join-item btn btn-sm btn-disabled sm:btn-md">{{text}}</span>',
154154
]);
155155
?>

templates/element/Packages/package-tile.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ class="btn btn-xs <?= $isActive ? $compatibilityGroup['activeClass'] : $compatib
163163
: array_values(array_unique(array_merge($existingSlugs, [$slug])));
164164
unset($tagQuery['page']);
165165
?>
166-
<a href="<?= h($buildFilterUrl($currentPath, $tagQuery)) ?>"
166+
<a rel="nofollow"
167+
href="<?= h($buildFilterUrl($currentPath, $tagQuery)) ?>"
167168
class="btn btn-xs <?= $tagIsActive ? $compatibilityGroup['dialogActiveClass'] : $compatibilityGroup['dialogInactiveClass'] ?>">
168169
<?= h($compatibilityGroup['tagLabel']($tag)) ?>
169170
</a>

templates/layout/default.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
</title>
3030
<?= $this->Html->meta('icon') ?>
3131
<link rel="canonical" href="<?= h($canonicalUrl) ?>">
32+
<?php if ($request->getQueryParams() !== []) : ?>
33+
<meta name="robots" content="noindex,nofollow">
34+
<?php endif; ?>
3235

3336
<?= $this->Html->css(['cake']) ?>
3437

webroot/.htaccess

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<IfModule mod_rewrite.c>
22
RewriteEngine On
3+
RewriteCond %{HTTP_USER_AGENT} meta-externalagent [NC]
4+
RewriteCond %{QUERY_STRING} (^|&)(keyword|cakephp_slugs|php_slugs|sort|direction|page)(%5B|=) [NC]
5+
RewriteRule ^ - [R=429,L]
6+
37
RewriteCond %{REQUEST_FILENAME} !-f
48
RewriteRule ^ index.php [L]
59
</IfModule>

0 commit comments

Comments
 (0)