Skip to content

Commit 4e520da

Browse files
add page noindex feature
- add checkbox in advanced settings - show icon next to privacy level in home view - describe feature in manual
1 parent 9c0c32e commit 4e520da

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

MANUAL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,19 @@ When you update or add pages in the bookmark's scope, you need to manually refre
6767

6868

6969

70+
### confidentiality
7071

72+
To manage which page are accessible to who, editors can set the [privacy level of their pages](#privacy).
73+
74+
#### search engine indexing
75+
76+
When something is public on the Web, and at least one hyperlink point to it, it will sooner or later became indexed by some robots. The most traditionnal ones are the **search engines Web crawlers** (sometimes even called spiders). When a page or a media is indexed by one of those robots, the associated search engine may display the ressource on their results lists.
77+
78+
Hopefully, we can tell those robot not to index our content by using a tag called `noindex`.
79+
80+
Inside W, this can be set per page under "advanced setting" in edit interface.
81+
82+
Note that this is only usefull for `public` pages as the others are not published on the Web. But it won't cause any harm either.
7183

7284

7385

app/class/Page.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ abstract class Page extends Item
5858
/** @var array<string, ?bool> $externallinks */
5959
protected array $externallinks = [];
6060

61+
protected bool $noindex = false;
62+
6163
protected int $version;
6264

6365
public const LATITUDE_MIN = -90;
@@ -141,6 +143,7 @@ public function reset(): void
141143
$this->setrefresh(0);
142144
$this->setpassword('');
143145
$this->externallinks = [];
146+
$this->noindex = false;
144147
$this->postprocessaction = false;
145148
}
146149

@@ -457,6 +460,11 @@ public function externallinks(string $option = 'array')
457460
return $this->externallinks;
458461
}
459462

463+
public function noindex(): bool
464+
{
465+
return $this->noindex;
466+
}
467+
460468
public function version(string $type = 'int'): int
461469
{
462470
return $this->version;
@@ -828,6 +836,11 @@ public function setexternallinks(array $externallinks): void
828836
$this->externallinks = $externallinks;
829837
}
830838

839+
public function setnoindex(bool $noindex): void
840+
{
841+
$this->noindex = $noindex;
842+
}
843+
831844

832845
// __________________________________ C O U N T E R S ______________________________
833846

app/class/Servicerender.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ protected function gethead(): string
230230

231231
$head .= "<meta property=\"og:url\" content=\"$url$id\">\n";
232232

233+
if ($this->page->noindex()) {
234+
$head .= '<meta name="robots" content="noindex">';
235+
}
236+
233237
foreach ($this->rsslist as $bookmark) {
234238
$atompath = Servicerss::atompath($bookmark->id());
235239
$title = htmlspecialchars($bookmark->name());

app/view/templates/editleftbar.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@
180180
<summary>Advanced</summary>
181181

182182
<fieldset>
183+
<p class="field">
184+
<label for="noindex">
185+
<span>no index</span>
186+
<a href="<?= $this->url('info', [], '#search-engine-indexing') ?>" class="help">?</a>
187+
</label>
188+
<input type="hidden" name="noindex" value="0">
189+
<input type="checkbox" name="noindex" value="1" id="noindex" form="update" <?= $page->noindex() ? 'checked' : '' ?>>
190+
</p>
183191
<p class="field">
184192
<label for="externalcss">External CSS</label>
185193
<input type="text" name="externalcss[]" id="externalcss" placeholder="add external address" form="update">

app/view/templates/home.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ class="redirection"
385385
<td class="secure">
386386
<?= $opt->securelink($item->secure('int') , $item->secure('string')) ?>
387387
<?= !empty($item->password()) ? '<i class="fa fa-lock" title="This page is password protected"></i>' : '' ?>
388+
<?= $item->noindex() ? '<i class="fa fa-search-minus" title="this page cannot be indexed by search engines">' : '' ?>
388389
</td>
389390
<?php endif ?>
390391
<?php if ($columns['authors']) : ?>

0 commit comments

Comments
 (0)