Skip to content
Snippets Groups Projects
Commit 55538a36 authored by Georgi Mateev's avatar Georgi Mateev
Browse files

[BUGFIX] Fix head tags: title, description, canonical and hreflang

parent cc1d3929
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ use SGalinski\SgJobs\Domain\Repository\JobApplicationRepository;
use SGalinski\SgJobs\Domain\Repository\JobRepository;
use SGalinski\SgJobs\Property\TypeConverter\UploadedFileReferenceConverter;
use SGalinski\SgMail\Service\MailTemplateService;
use SGalinski\SgSeo\Service\HeadTagService;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\ImmediateResponseException;
......@@ -177,12 +178,18 @@ class JoblistController extends ActionController {
throw new \InvalidArgumentException('Given Job Id is invalid!');
}
$GLOBALS['TSFE']->page['titlebyextension'] = $job->getTitle();
$GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($job->getDescription(), 0, 200));
if (version_compare(
ExtensionManagementUtility::getExtensionVersion('sg_seo'),
'5.0.0', '<')) {
if (version_compare(ExtensionManagementUtility::getExtensionVersion('sg_seo'), '5.0.0', '>=')) {
$headTagService = GeneralUtility::makeInstance(
HeadTagService::class,
TRUE,
$job->getTitle(),
$job->getDescription(),
'&tx_sgjobs_jobapplication[jobId]=' . $jobId
);
$headTagService->execute();
} else {
$GLOBALS['TSFE']->page['titlebyextension'] = $job->getTitle();
$GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($job->getDescription(), 0, 200));
$GLOBALS['TSFE']->page['extensionArgumentsForCanonicalAndHrefLang'] =
'&tx_sgjobs_jobapplication[jobId]=' . $jobId;
}
......@@ -277,12 +284,18 @@ class JoblistController extends ActionController {
/** @var Job $job */
$job = $this->jobRepository->findByUid($jobId);
if ($job) {
$GLOBALS['TSFE']->page['titlebyextension'] = $job->getTitle();
$GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($job->getDescription(), 0, 200));
if (version_compare(
ExtensionManagementUtility::getExtensionVersion('sg_seo'),
'5.0.0', '<')) {
if (version_compare(ExtensionManagementUtility::getExtensionVersion('sg_seo'), '5.0.0', '>=')) {
$headTagService = GeneralUtility::makeInstance(
HeadTagService::class,
FALSE,
$job->getTitle(),
$job->getDescription(),
'&tx_sgjobs_jobapplication[jobId]=' . $jobId
);
$headTagService->execute();
} else {
$GLOBALS['TSFE']->page['titlebyextension'] = $job->getTitle();
$GLOBALS['TSFE']->page['description'] = \strip_tags(\substr($job->getDescription(), 0, 200));
$GLOBALS['TSFE']->page['extensionArgumentsForCanonicalAndHrefLang'] =
'&tx_sgjobs_jobapplication[jobId]=' . $jobId;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment