Skip to content

Commit

Permalink
Replace meta tags with HTTP header
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Oct 30, 2024
1 parent 17059b9 commit f1aefa6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/src/Admin/Presenters/templates/@layout.latte
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{layout "../../../Www/Presenters/templates/@layout.latte"}
{var $containerExtraClass = 'admin'}
{var $headerLinks = false}
{var $robots = 'noindex, nofollow'}
{define #feeds}{/define}
{define #scriptsReplace}
{script app + admin async, defer}
Expand Down
4 changes: 4 additions & 0 deletions app/src/EasterEgg/FourOhFourButFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace MichalSpacekCz\EasterEgg;

use MichalSpacekCz\Http\Robots\Robots;
use MichalSpacekCz\Http\Robots\RobotsRule;
use Nette\Application\Responses\TextResponse;
use Nette\Application\UI\Presenter;
use Nette\Http\IRequest;
Expand All @@ -17,6 +19,7 @@

public function __construct(
private IRequest $httpRequest,
private readonly Robots $robots,
) {
}

Expand All @@ -39,6 +42,7 @@ public function sendItMaybe(Presenter $presenter): void

private function sendIt(Presenter $presenter, string $template): never
{
$this->robots->setHeader([RobotsRule::NoIndex, RobotsRule::NoFollow]);
$presenter->sendResponse(new TextResponse(file_get_contents($template)));
}

Expand Down
1 change: 0 additions & 1 deletion app/src/EasterEgg/templates/etcPasswd.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>/etc/passwd</title>
</head>
Expand Down
4 changes: 4 additions & 0 deletions app/src/Www/Presenters/TrainingsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use MichalSpacekCz\Form\TrainingApplicationPreliminaryFormFactory;
use MichalSpacekCz\Form\UiForm;
use MichalSpacekCz\Formatter\TexyFormatter;
use MichalSpacekCz\Http\Robots\Robots;
use MichalSpacekCz\Http\Robots\RobotsRule;
use MichalSpacekCz\ShouldNotHappenException;
use MichalSpacekCz\Training\Applications\TrainingApplications;
use MichalSpacekCz\Training\Applications\TrainingApplicationSessionSection;
Expand Down Expand Up @@ -61,6 +63,7 @@ public function __construct(
private readonly TrainingFilesDownload $trainingFilesDownload,
private readonly Translator $translator,
private readonly Session $sessionHandler,
private readonly Robots $robots,
) {
parent::__construct();
}
Expand Down Expand Up @@ -228,6 +231,7 @@ public function actionFiles(string $name, ?string $param): void
if (count($application->getFiles()) === 0) {
throw new BadRequestException('No files for application id ' . $application->getId());
}
$this->robots->setHeader([RobotsRule::NoIndex, RobotsRule::NoFollow]);

$this->template->trainingTitle = $training->getName();
$this->template->trainingName = ($training->isCustom() ? null : $training->getAction());
Expand Down
1 change: 0 additions & 1 deletion app/src/Www/Presenters/templates/Trainings/files.latte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{varType MichalSpacekCz\Training\Files\TrainingFile[] $files}
{var $robots = 'noindex, nofollow'}

{define #menu}
&raquo; <a n:href="Homepage:">Michal Špaček</a>
Expand Down

0 comments on commit f1aefa6

Please sign in to comment.