TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:39 +02:00
commit e54ab24745
68 changed files with 3683 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/vendor/
+184
View File
@@ -0,0 +1,184 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\Canonical;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Domain\Page;
use TYPO3\CMS\Core\Domain\RecordFactory;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Type\DocType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\RootlineUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Utility\CanonicalizationUtility;
use TYPO3\CMS\Seo\Event\ModifyUrlForCanonicalTagEvent;
use TYPO3\CMS\Seo\Exception\CanonicalGenerationDisabledException;
/**
* Class to add the canonical tag to the page
*
* @internal this class is not part of TYPO3's Core API.
*/
#[Autoconfigure(public: true)]
readonly class CanonicalGenerator
{
public function __construct(
private EventDispatcherInterface $eventDispatcher,
private PageRenderer $pageRenderer,
private RecordFactory $recordFactory,
private PageRepository $pageRepository,
) {}
public function generate(array $params): string
{
/** @var ServerRequestInterface $request */
$request = $params['request'];
$pageRecord = $request->getAttribute('frontend.page.information')->getPageRecord();
$canonicalGenerationDisabledException = null;
$href = '';
$typoScriptConfigArray = $request->getAttribute('frontend.typoscript')->getConfigArray();
try {
if ($typoScriptConfigArray['disableCanonical'] ?? false) {
throw new CanonicalGenerationDisabledException('Generation of the canonical tag is disabled via TypoScript "disableCanonical"', 1706104146);
}
if ((int)$pageRecord['no_index'] === 1) {
throw new CanonicalGenerationDisabledException('Generation of the canonical is disabled due to "no_index" being set active in the page properties', 1706104147);
}
// 1) Check if page has canonical URL set
$href = $this->checkForCanonicalLink($request);
if ($href === '') {
// 2) Check if page show content from other page
$href = $this->checkContentFromPid($request);
}
if ($href === '') {
// 3) Fallback, create canonical URL
$href = $this->checkDefaultCanonical($request);
}
} catch (CanonicalGenerationDisabledException $canonicalGenerationDisabledException) {
} finally {
/** @var Page $page */
$page = $this->recordFactory->createFromDatabaseRow('pages', $pageRecord);
$event = $this->eventDispatcher->dispatch(
new ModifyUrlForCanonicalTagEvent($request, $page, $href, $canonicalGenerationDisabledException)
);
$href = $event->getUrl();
}
if ($href !== '') {
$docType = DocType::createFromConfigurationKey($typoScriptConfigArray['doctype'] ?? '');
$canonical = '<link ' . GeneralUtility::implodeAttributes([
'rel' => 'canonical',
'href' => $href,
], true) . ($docType->isXmlCompliant() ? '/' : '') . '>' . LF;
$this->pageRenderer->addHeaderData($canonical);
return $canonical;
}
return '';
}
protected function checkForCanonicalLink(ServerRequestInterface $request): string
{
$pageRecord = $request->getAttribute('frontend.page.information')->getPageRecord();
$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$cObj->setRequest($request);
$cObj->start($pageRecord, 'pages');
if (!empty($pageRecord['canonical_link'])) {
return $cObj->createUrl([
'parameter' => $pageRecord['canonical_link'],
'forceAbsoluteUrl' => true,
]);
}
return '';
}
protected function checkContentFromPid(ServerRequestInterface $request): string
{
$pageInformation = $request->getAttribute('frontend.page.information');
$id = $pageInformation->getId();
$contentPid = $pageInformation->getContentFromPid();
if ($id !== $contentPid) {
$targetPid = $contentPid;
if ($targetPid > 0) {
$targetPageRecord = $this->pageRepository->getPage($contentPid, true);
if (!empty($targetPageRecord['canonical_link'])) {
$targetPid = $targetPageRecord['canonical_link'];
}
$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$cObj->setRequest($request);
$cObj->start($request->getAttribute('frontend.page.information')->getPageRecord(), 'pages');
return $cObj->createUrl([
'parameter' => $targetPid,
'forceAbsoluteUrl' => true,
]);
}
}
return '';
}
protected function checkDefaultCanonical(ServerRequestInterface $request): string
{
$pageInformation = $request->getAttribute('frontend.page.information');
$id = $pageInformation->getId();
// We should only create a canonical link to the target, if the target is within a valid site root
$inSiteRoot = $this->isPageWithinSiteRoot($id);
if (!$inSiteRoot) {
return '';
}
// Temporarily remove current mount point information as we want to have the
// URL of the target page and not of the page within the mount point if the
// current page is a mount point.
$pageInformation = clone $pageInformation;
$pageInformation->setMountPoint('');
$request = $request->withAttribute('frontend.page.information', $pageInformation);
$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$cObj->setRequest($request);
$cObj->start($pageInformation->getPageRecord(), 'pages');
return $cObj->createUrl([
'parameter' => $id . ',' . $request->getAttribute('routing')->getPageType(),
'forceAbsoluteUrl' => true,
'addQueryString' => true,
'addQueryString.' => [
'exclude' => implode(
',',
CanonicalizationUtility::getParamsToExcludeForCanonicalizedUrl(
$id,
(array)$GLOBALS['TYPO3_CONF_VARS']['FE']['additionalCanonicalizedUrlParameters'],
$request
)
),
],
]);
}
protected function isPageWithinSiteRoot(int $id): bool
{
$rootline = GeneralUtility::makeInstance(RootlineUtility::class, $id)->get();
foreach ($rootline as $page) {
if ($page['is_siteroot']) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\Event;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Domain\Page;
use TYPO3\CMS\Seo\Exception\CanonicalGenerationDisabledException;
/**
* PSR-14 event to alter (or empty) a canonical URL for the href="" attribute of a canonical URL.
*/
final class ModifyUrlForCanonicalTagEvent
{
public function __construct(
private readonly ServerRequestInterface $request,
private readonly Page $page,
private string $url,
private readonly ?CanonicalGenerationDisabledException $canonicalGenerationDisabledException
) {}
public function getUrl(): string
{
return $this->url;
}
public function setUrl(string $url): void
{
$this->url = $url;
}
public function getRequest(): ServerRequestInterface
{
return $this->request;
}
public function getPage(): Page
{
return $this->page;
}
public function getCanonicalGenerationDisabledException(): ?CanonicalGenerationDisabledException
{
return $this->canonicalGenerationDisabledException;
}
}
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\Exception;
use TYPO3\CMS\Core\Exception;
/**
* Thrown if generation of the canonical is disabled
*/
class CanonicalGenerationDisabledException extends Exception {}
+121
View File
@@ -0,0 +1,121 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\HrefLang;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\LanguageAspectFactory;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor;
use TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent;
/**
* Class to add the hreflang tags to the page
*
* @internal
*/
class HrefLangGenerator
{
public function __construct(
protected ContentObjectRenderer $cObj,
protected LanguageMenuProcessor $languageMenuProcessor,
) {}
#[AsEventListener('typo3-seo/hreflangGenerator')]
public function __invoke(ModifyHrefLangTagsEvent $event): void
{
$request = $event->getRequest();
$pageInformation = $request->getAttribute('frontend.page.information');
$pageRecord = $pageInformation->getPageRecord();
if ((int)$pageRecord['no_index'] === 1) {
return;
}
$this->cObj->setRequest($event->getRequest());
$languages = $this->languageMenuProcessor->process($this->cObj, [], [], []);
$site = $request->getAttribute('site');
$siteLanguage = $request->getAttribute('language', $site->getDefaultLanguage());
$pageId = $pageInformation->getId();
$hrefLangs = $event->getHrefLangs();
foreach ($languages['languagemenu'] as $language) {
if (!empty($language['link']) && $language['hreflang']) {
if ($language['languageId'] === 0) {
// No need to fetch default language
$page = ($pageRecord['_TRANSLATION_SOURCE'] ?? null)?->toArray(true) ?? $pageRecord;
} elseif ($language['languageId'] === ($pageRecord['_REQUESTED_OVERLAY_LANGUAGE'] ?? false)) {
// No need to fetch current language
$page = $pageRecord;
} else {
$page = $this->getTranslatedPageRecord($pageId, $language['languageId'], $site);
}
// do not set hreflang if a page is not translated explicitly
if (empty($page)) {
continue;
}
// do not set hreflang when canonical is set explicitly
if (!empty($page['canonical_link'])) {
continue;
}
$href = $this->getAbsoluteUrl($language['link'], $siteLanguage);
$hrefLangs[$language['hreflang']] = $href;
}
}
if (count($hrefLangs) > 1) {
if (array_key_exists($languages['languagemenu'][0]['hreflang'], $hrefLangs)) {
$hrefLangs['x-default'] = $hrefLangs[$languages['languagemenu'][0]['hreflang']];
}
}
$event->setHrefLangs($hrefLangs);
}
protected function getAbsoluteUrl(string $url, SiteLanguage $siteLanguage): string
{
$uri = new Uri($url);
if (empty($uri->getHost())) {
$url = $siteLanguage->getBase()->withPath($uri->getPath());
if ($uri->getQuery()) {
$url = $url->withQuery($uri->getQuery());
}
}
return (string)$url;
}
protected function getTranslatedPageRecord(int $pageId, int $languageId, Site $site): array
{
$targetSiteLanguage = $site->getLanguageById($languageId);
$languageAspect = LanguageAspectFactory::createFromSiteLanguage($targetSiteLanguage);
$context = clone GeneralUtility::makeInstance(Context::class);
$context->setAspect('language', $languageAspect);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class, $context);
$pageRecord = $pageRepository->getPage($pageId);
// Overlay was requested but did not apply
if ($languageId > 0 && !isset($pageRecord['_LOCALIZED_UID'])) {
return [];
}
return $pageRecord;
}
}
+193
View File
@@ -0,0 +1,193 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\MetaTag;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Service\ImageService;
use TYPO3\CMS\Frontend\Resource\FileCollector;
/**
* Class to add the metatags for the SEO fields in core
*
* @internal
*/
#[Autoconfigure(public: true)]
readonly class MetaTagGenerator
{
public function __construct(
protected MetaTagManagerRegistry $metaTagManagerRegistry,
protected ImageService $imageService
) {}
/**
* Generate the meta tags that can be set in backend and add them to frontend by using the MetaTag API
*/
public function generate(array $params)
{
$twitterCardTagRequired = false;
/** @var ServerRequestInterface $request */
$request = $params['request'];
$pageRecord = $request->getAttribute('frontend.page.information')->getPageRecord();
if (!empty($pageRecord['description'])) {
$manager = $this->metaTagManagerRegistry->getManagerForProperty('description');
$manager->addProperty('description', $pageRecord['description']);
}
if (!empty($pageRecord['og_title'])) {
$twitterCardTagRequired = true;
$manager = $this->metaTagManagerRegistry->getManagerForProperty('og:title');
$manager->addProperty('og:title', $pageRecord['og_title']);
}
if (!empty($pageRecord['og_description'])) {
$twitterCardTagRequired = true;
$manager = $this->metaTagManagerRegistry->getManagerForProperty('og:description');
$manager->addProperty('og:description', $pageRecord['og_description']);
}
if (!empty($pageRecord['og_image'])) {
$fileCollector = GeneralUtility::makeInstance(FileCollector::class);
$fileCollector->addFilesFromRelation('pages', 'og_image', $pageRecord);
$manager = $this->metaTagManagerRegistry->getManagerForProperty('og:image');
$ogImages = $this->generateSocialImages($fileCollector->getFiles());
foreach ($ogImages as $ogImage) {
$twitterCardTagRequired = true;
$subProperties = [];
$subProperties['url'] = $ogImage['url'];
$subProperties['width'] = $ogImage['width'];
$subProperties['height'] = $ogImage['height'];
if (!empty($ogImage['alternative'])) {
$subProperties['alt'] = $ogImage['alternative'];
}
$manager->addProperty(
'og:image',
$ogImage['url'],
$subProperties
);
}
}
if (!empty($pageRecord['twitter_title'])) {
$twitterCardTagRequired = true;
$manager = $this->metaTagManagerRegistry->getManagerForProperty('twitter:title');
$manager->addProperty('twitter:title', $pageRecord['twitter_title']);
}
if (!empty($pageRecord['twitter_description'])) {
$twitterCardTagRequired = true;
$manager = $this->metaTagManagerRegistry->getManagerForProperty('twitter:description');
$manager->addProperty('twitter:description', $pageRecord['twitter_description']);
}
if (!empty($pageRecord['twitter_image'])) {
$fileCollector = GeneralUtility::makeInstance(FileCollector::class);
$fileCollector->addFilesFromRelation('pages', 'twitter_image', $pageRecord);
$manager = $this->metaTagManagerRegistry->getManagerForProperty('twitter:image');
$twitterImages = $this->generateSocialImages($fileCollector->getFiles());
foreach ($twitterImages as $twitterImage) {
$twitterCardTagRequired = true;
$subProperties = [];
if (!empty($twitterImage['alternative'])) {
$subProperties['alt'] = $twitterImage['alternative'];
}
$manager->addProperty(
'twitter:image',
$twitterImage['url'],
$subProperties
);
}
}
$twitterCard = $pageRecord['twitter_card'] ?: ($twitterCardTagRequired ? 'summary' : '');
if (!empty($twitterCard)) {
$manager = $this->metaTagManagerRegistry->getManagerForProperty('twitter:card');
$manager->addProperty('twitter:card', $twitterCard);
}
$noIndex = ($pageRecord['no_index']) ? 'noindex' : 'index';
$noFollow = ($pageRecord['no_follow']) ? 'nofollow' : 'follow';
if ($noIndex === 'noindex' || $noFollow === 'nofollow') {
$manager = $this->metaTagManagerRegistry->getManagerForProperty('robots');
$manager->addProperty('robots', implode(',', [$noIndex, $noFollow]));
}
}
/**
* @param list<FileReference> $fileReferences
*/
protected function generateSocialImages(array $fileReferences): array
{
$socialImages = [];
foreach ($fileReferences as $fileReference) {
$arguments = $fileReference->getProperties();
$image = $this->processSocialImage($fileReference);
$socialImages[] = [
'url' => $this->imageService->getImageUri($image, true),
'width' => floor((float)$image->getProperty('width')),
'height' => floor((float)$image->getProperty('height')),
'alternative' => $arguments['alternative'],
];
}
return $socialImages;
}
protected function processSocialImage(FileReference $fileReference): FileInterface
{
$arguments = $fileReference->getProperties();
$cropVariantCollection = CropVariantCollection::create((string)($arguments['crop'] ?? ''));
$cropVariantName = ($arguments['cropVariant'] ?? false) ?: 'social';
$cropArea = $cropVariantCollection->getCropArea($cropVariantName);
$crop = $cropArea->makeAbsoluteBasedOnFile($fileReference);
$processingConfiguration = [
'crop' => $crop,
'maxWidth' => 2000,
];
// The image needs to be processed if:
// - the image width is greater than the defined maximum width, or
// - there is a cropping other than the full image (starts at 0,0 and has a width and height of 100%) defined
$needsProcessing = $fileReference->getProperty('width') > $processingConfiguration['maxWidth']
|| !$cropArea->isEmpty();
if (!$needsProcessing) {
return $fileReference->getOriginalFile();
}
return $fileReference->getOriginalFile()->process(
ProcessedFile::CONTEXT_IMAGECROPSCALEMASK,
$processingConfiguration
);
}
}
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\MetaTag;
use TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager;
/**
* @internal this class is not part of TYPO3's Core API.
*/
class OpenGraphMetaTagManager extends AbstractMetaTagManager
{
/**
* The default attribute that defines the name of the property
*
* This creates tags like <meta property="" /> by default
*
* @var string
*/
protected $defaultNameAttribute = 'property';
/**
* Array of properties that can be handled by this manager
*
* @var array
*/
protected $handledProperties = [
'og:type' => [],
'og:title' => [],
'og:description' => [],
'og:site_name' => [],
'og:url' => [],
'og:audio' => [],
'og:video' => [],
'og:determiner' => [],
'og:locale' => [
'allowedSubProperties' => [
'alternate' => [
'allowMultipleOccurrences' => true,
],
],
],
'og:image' => [
'allowMultipleOccurrences' => true,
'allowedSubProperties' => [
'url' => [],
'secure_url' => [],
'type' => [],
'width' => [],
'height' => [],
'alt' => [],
],
],
];
}
@@ -0,0 +1,72 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\MetaTag;
use TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager;
/**
* @internal this class is not part of TYPO3's Core API.
*/
class TwitterCardMetaTagManager extends AbstractMetaTagManager
{
/**
* Array of properties that can be handled by this manager
*
* @var array
*/
protected $handledProperties = [
'twitter:card' => [],
'twitter:site' => [
'allowedSubProperties' => [
'id' => [],
],
],
'twitter:creator' => [
'allowedSubProperties' => [
'id' => [],
],
],
'twitter:description' => [],
'twitter:title' => [],
'twitter:image' => [
'allowedSubProperties' => [
'alt' => [],
],
],
'twitter:player' => [
'allowedSubProperties' => [
'width' => [],
'height' => [],
'stream' => [],
],
],
'twitter:app' => [
'allowedSubProperties' => [
'name:iphone' => [],
'id:iphone' => [],
'url:iphone' => [],
'name:ipad' => [],
'id:ipad' => [],
'url:ipad' => [],
'name:googleplay' => [],
'id:googleplay' => [],
'url:googleplay' => [],
],
],
];
}
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\PageTitle;
use TYPO3\CMS\Core\PageTitle\AbstractPageTitleProvider;
/**
* This class will take care of the seo title that can be set in the backend
* @internal this class is not part of TYPO3's Core API.
*/
class SeoTitlePageTitleProvider extends AbstractPageTitleProvider
{
public function getTitle(): string
{
$pageInformation = $this->request->getAttribute('frontend.page.information');
return (string)($pageInformation->getPageRecord()['seo_title'] ?? '');
}
}
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\Widgets;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\View\BackendViewFactory;
use TYPO3\CMS\Dashboard\Widgets\RequestAwareWidgetInterface;
use TYPO3\CMS\Dashboard\Widgets\WidgetConfigurationInterface;
use TYPO3\CMS\Dashboard\Widgets\WidgetInterface;
use TYPO3\CMS\Seo\Widgets\Provider\PagesWithoutDescriptionDataProvider;
/**
* @internal
*/
final class PagesWithoutDescriptionWidget implements WidgetInterface, RequestAwareWidgetInterface
{
private ServerRequestInterface $request;
public function __construct(
private readonly WidgetConfigurationInterface $configuration,
private readonly PagesWithoutDescriptionDataProvider $dataProvider,
private readonly BackendViewFactory $backendViewFactory,
private readonly array $options,
) {}
public function setRequest(ServerRequestInterface $request): void
{
$this->request = $request;
}
public function renderWidgetContent(): string
{
$view = $this->backendViewFactory->create($this->request, ['typo3/cms-dashboard', 'typo3/cms-seo']);
$view->assignMultiple([
'pages' => $this->dataProvider->getPages(),
'options' => $this->getOptions(),
'configuration' => $this->configuration,
]);
return $view->render('Widget/PagesWithoutDescription');
}
public function getOptions(): array
{
return $this->options;
}
}
@@ -0,0 +1,108 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\Widgets\Provider;
use Doctrine\DBAL\Result;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
/**
* @internal
*/
final readonly class PagesWithoutDescriptionDataProvider
{
public function __construct(
private SiteFinder $siteFinder,
private ConnectionPool $connectionPool,
private array $excludedDoktypes,
private int $limit
) {}
public function getPages(): array
{
$backendUser = $this->getBackendUser();
$items = [];
if (!$backendUser->check('tables_modify', 'pages')) {
// Early return in case user is not allowed to modify pages at all
return $items;
}
$rowCount = 0;
$pagesResult = $this->getPotentialPages();
while ($row = $pagesResult->fetchAssociative()) {
if (!$backendUser->doesUserHaveAccess($row, Permission::PAGE_EDIT)) {
continue;
}
BackendUtility::workspaceOL('pages', $row, $backendUser->workspace);
$pageId = $row['l10n_parent'] ?: $row['uid'];
try {
$site = $this->siteFinder->getSiteByPageId($pageId);
// make sure the language of the row actually exists in the site
$site->getLanguageById($row['language_tag']);
} catch (SiteNotFoundException|\InvalidArgumentException) {
continue;
}
$router = $site->getRouter();
$row['frontendUrl'] = (string)$router->generateUri($pageId, ['_language' => $row['language_tag']]);
$items[] = $row;
$rowCount++;
if ($rowCount >= $this->limit) {
return $items;
}
}
return $items;
}
/**
* Fetches potential candidates for the list from the database.
* Doktypes that do not require a meta description (such as directories and links) are ignored.
* Pages with noindex or a canonical are also ignored for this reason.
* Language versions are considered individually.
* Workspace versions are considered for the workspace the user is in.
*/
private function getPotentialPages(): Result
{
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages');
$queryBuilder->getRestrictions()->add(new WorkspaceRestriction($this->getBackendUser()->workspace));
return $queryBuilder
->select('uid', 'pid', 'title', 'slug', 'sys_language_uid', 'l10n_parent', 'perms_userid', 'perms_groupid', 'perms_user', 'perms_group', 'perms_everybody')
->from('pages')
->where(
$queryBuilder->expr()->notIn('doktype', $this->excludedDoktypes),
$queryBuilder->expr()->and(
$queryBuilder->expr()->eq('no_index', $queryBuilder->createNamedParameter(0)),
$queryBuilder->expr()->eq('canonical_link', $queryBuilder->createNamedParameter('')),
),
$queryBuilder->expr()->or(
$queryBuilder->expr()->eq('description', $queryBuilder->createNamedParameter('')),
$queryBuilder->expr()->isNull('description')
),
)
->orderBy('tstamp', 'DESC')
->executeQuery();
}
private function getBackendUser(): BackendUserAuthentication
{
return $GLOBALS['BE_USER'];
}
}
@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* Base class for XmlSitemapProviders to extend
*/
abstract class AbstractXmlSitemapDataProvider implements XmlSitemapDataProviderInterface
{
protected string $key;
protected array $items = [];
protected array $config = [];
protected ContentObjectRenderer $cObj;
protected int $numberOfItemsPerPage = 1000;
protected ServerRequestInterface $request;
public function __construct(ServerRequestInterface $request, string $key, array $config = [], ?ContentObjectRenderer $cObj = null)
{
$this->key = $key;
$this->config = $config;
$this->request = $request;
$this->cObj = $cObj ?? GeneralUtility::makeInstance(ContentObjectRenderer::class);
$this->cObj->setRequest($request);
}
public function getKey(): string
{
return $this->key;
}
public function getNumberOfPages(): int
{
return (int)ceil(count($this->items) / $this->numberOfItemsPerPage);
}
public function getLastModified(): int
{
$lastMod = 0;
foreach ($this->items as $item) {
if ((int)($item['lastMod'] ?? 0) > $lastMod) {
$lastMod = (int)$item['lastMod'];
}
}
return $lastMod;
}
protected function defineUrl(array $data): array
{
return $data;
}
public function getItems(): array
{
$pageNumber = (int)($this->request->getQueryParams()['tx_seo']['page'] ?? 0);
$page = $pageNumber > 0 ? $pageNumber : 0;
$items = array_slice(
$this->items,
$page * $this->numberOfItemsPerPage,
$this->numberOfItemsPerPage
);
return array_map([$this, 'defineUrl'], $items);
}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap\Exception;
use TYPO3\CMS\Core\Resource\Exception;
class InvalidConfigurationException extends Exception {}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap\Exception;
use TYPO3\CMS\Core\Resource\Exception;
class MissingConfigurationException extends Exception {}
@@ -0,0 +1,119 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\LanguageAspect;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Domain\RecordFactory;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* Class to generate a XML sitemap for pages
* @internal this class is not part of TYPO3's Core API.
*/
class PagesXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
{
public function __construct(ServerRequestInterface $request, string $key, array $config = [], ?ContentObjectRenderer $cObj = null)
{
parent::__construct($request, $key, $config, $cObj);
$this->generateItems();
}
protected function generateItems(): void
{
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$pages = $pageRepository->getPagesOverlay($this->getPages());
$languageAspect = $this->getCurrentLanguageAspect();
foreach ($pages as $page) {
if (!$pageRepository->isPageSuitableForLanguage($page, $languageAspect)) {
continue;
}
$this->items[] = $page + [
'lastMod' => (int)($page['SYS_LASTCHANGED'] ?: $page['tstamp']),
'changefreq' => $page['sitemap_changefreq'],
'priority' => (float)$page['sitemap_priority'],
];
}
}
protected function getPages(): array
{
if (!empty($this->config['rootPage'])) {
$rootPageId = (int)$this->config['rootPage'];
} else {
$site = $this->request->getAttribute('site');
$rootPageId = $site->getRootPageId();
}
$excludePagesRecursive = GeneralUtility::intExplode(',', (string)($this->config['excludePagesRecursive'] ?? ''), true);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$pageIds = $pageRepository->getDescendantPageIdsRecursive($rootPageId, 99, 0, $excludePagesRecursive);
$pageIds = array_merge([$rootPageId], $pageIds);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('pages');
$constraints = [
$queryBuilder->expr()->in('uid', $pageIds),
];
if (!empty($this->config['additionalWhere'])) {
$constraints[] = QueryHelper::quoteDatabaseIdentifiers($queryBuilder->getConnection(), QueryHelper::stripLogicalOperatorPrefix($this->config['additionalWhere']));
}
if (!empty($this->config['excludedDoktypes'])) {
$excludedDoktypes = GeneralUtility::intExplode(',', (string)$this->config['excludedDoktypes']);
if (!empty($excludedDoktypes)) {
$constraints[] = $queryBuilder->expr()->notIn('doktype', implode(',', $excludedDoktypes));
}
}
$pages = $queryBuilder->select('*')
->from('pages')
->where(...$constraints)
->orderBy('uid', 'ASC')
->executeQuery()
->fetchAllAssociative();
return $pages;
}
protected function getCurrentLanguageAspect(): LanguageAspect
{
return GeneralUtility::makeInstance(Context::class)->getAspect('language');
}
protected function defineUrl(array $data): array
{
$typoLinkConfig = [
'page' => GeneralUtility::makeInstance(RecordFactory::class)->createFromDatabaseRow('pages', $data),
'parameter' => $data['uid'],
'forceAbsoluteUrl' => 1,
];
$data['loc'] = $this->cObj->createUrl($typoLinkConfig);
return $data;
}
}
@@ -0,0 +1,175 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Schema\Capability\LanguageAwareSchemaCapability;
use TYPO3\CMS\Core\Schema\Capability\TcaSchemaCapability;
use TYPO3\CMS\Core\Schema\TcaSchemaFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Seo\XmlSitemap\Exception\MissingConfigurationException;
/**
* XmlSiteDataProvider will provide information for the XML sitemap for a specific database table
* @internal this class is not part of TYPO3's Core API.
*/
class RecordsXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
{
private TcaSchemaFactory $tcaSchemaFactory;
public function __construct(ServerRequestInterface $request, string $key, array $config = [], ?ContentObjectRenderer $cObj = null)
{
parent::__construct($request, $key, $config, $cObj);
$this->tcaSchemaFactory = GeneralUtility::makeInstance(TcaSchemaFactory::class);
$this->generateItems();
}
/**
* @throws MissingConfigurationException
*/
public function generateItems(): void
{
$table = $this->config['table'];
if (!$this->tcaSchemaFactory->has($table)) {
throw new MissingConfigurationException(
'No configuration found for sitemap ' . $this->getKey(),
1535576053
);
}
$schema = $this->tcaSchemaFactory->get($table);
$pids = !empty($this->config['pid']) ? GeneralUtility::intExplode(',', (string)$this->config['pid']) : [];
$lastModifiedField = $this->config['lastModifiedField'] ?? 'tstamp';
$sortField = $this->config['sortField'] ?? 'sorting';
$changeFreqField = $schema->hasField($this->config['changeFreqField'] ?? '') ? $this->config['changeFreqField'] : '';
$priorityField = $schema->hasField($this->config['priorityField'] ?? '') ? $this->config['priorityField'] : '';
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable($table);
$constraints = [];
if ($schema->isLanguageAware()) {
/** @var LanguageAwareSchemaCapability $languageCapability */
$languageCapability = $schema->getCapability(TcaSchemaCapability::Language);
$constraints[] = $queryBuilder->expr()->in(
$languageCapability->getLanguageField()->getName(),
[
-1, // All languages
$this->getLanguageId(), // Current language
]
);
}
if (!empty($pids)) {
$recursiveLevel = isset($this->config['recursive']) ? (int)$this->config['recursive'] : 0;
$pids = GeneralUtility::makeInstance(PageRepository::class)->getPageIdsRecursive($pids, $recursiveLevel);
$constraints[] = $queryBuilder->expr()->in('pid', $pids);
}
if (!empty($this->config['additionalWhere'])) {
$constraints[] = QueryHelper::quoteDatabaseIdentifiers($queryBuilder->getConnection(), QueryHelper::stripLogicalOperatorPrefix($this->config['additionalWhere']));
}
$queryBuilder->getRestrictions()->add(
GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->getCurrentWorkspaceAspect()->getId())
);
$queryBuilder->select('*')
->from($table);
if (!empty($constraints)) {
$queryBuilder->where(
...$constraints
);
}
$rows = $queryBuilder->orderBy($sortField)
->executeQuery()
->fetchAllAssociative();
foreach ($rows as $row) {
$item = [
'data' => $row,
'lastMod' => (int)$row[$lastModifiedField],
];
if (!empty($changeFreqField)) {
$item['changefreq'] = $row[$changeFreqField];
}
$item['priority'] = !empty($priorityField) ? $row[$priorityField] : 0.5;
$this->items[] = $item;
}
}
protected function defineUrl(array $data): array
{
$pageId = $this->request->getAttribute('frontend.page.information')->getId();
$pageId = $this->config['url']['pageId'] ?? $pageId;
$additionalParams = $this->getUrlFieldParameterMap($data['data']);
$additionalParams = $this->getUrlAdditionalParams($additionalParams);
$data['loc'] = $this->cObj->createUrl([
'parameter' => $pageId,
'queryParameters' => $additionalParams,
'forceAbsoluteUrl' => 1,
]);
return $data;
}
protected function getUrlFieldParameterMap(array $data): array
{
$additionalParams = [];
if (!empty($this->config['url']['fieldToParameterMap'])
&& is_array($this->config['url']['fieldToParameterMap'])) {
foreach ($this->config['url']['fieldToParameterMap'] as $field => $urlPart) {
$paramValue = $data[$field];
parse_str($urlPart . '=' . urlencode((string)$paramValue), $nested);
$additionalParams = array_replace_recursive($additionalParams, $nested);
}
}
return $additionalParams;
}
protected function getUrlAdditionalParams(array $additionalParams): array
{
if (!empty($this->config['url']['additionalGetParameters'])
&& is_array($this->config['url']['additionalGetParameters'])) {
$additionalParams = array_replace_recursive($additionalParams, $this->config['url']['additionalGetParameters']);
}
return $additionalParams;
}
protected function getLanguageId(): int
{
$context = GeneralUtility::makeInstance(Context::class);
return (int)$context->getPropertyFromAspect('language', 'id');
}
protected function getCurrentWorkspaceAspect(): WorkspaceAspect
{
return GeneralUtility::makeInstance(Context::class)->getAspect('workspace');
}
}
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* Interface for XmlSitemapDataProviders containing the methods that are called by the XmlSitemapRenderer
*/
interface XmlSitemapDataProviderInterface
{
public function __construct(ServerRequestInterface $request, string $name, array $config = [], ?ContentObjectRenderer $cObj = null);
public function getKey(): string;
public function getItems(): array;
public function getLastModified(): int;
public function getNumberOfPages(): int;
}
+201
View File
@@ -0,0 +1,201 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Seo\XmlSitemap;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Attribute\AsAllowedCallable;
use TYPO3\CMS\Core\Http\PropagateResponseException;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\HashValue;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\PolicyRegistry;
use TYPO3\CMS\Core\SystemResource\Exception\CanNotResolvePublicResourceException;
use TYPO3\CMS\Core\SystemResource\Exception\CanNotResolveSystemResourceException;
use TYPO3\CMS\Core\SystemResource\Exception\SystemResourceDoesNotExistException;
use TYPO3\CMS\Core\SystemResource\Publishing\SystemResourcePublisherInterface;
use TYPO3\CMS\Core\SystemResource\SystemResourceFactory;
use TYPO3\CMS\Core\SystemResource\Type\PublicResourceInterface;
use TYPO3\CMS\Core\SystemResource\Type\SystemResourceInterface;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\View\ViewFactoryData;
use TYPO3\CMS\Core\View\ViewFactoryInterface;
use TYPO3\CMS\Core\View\ViewInterface;
use TYPO3\CMS\Frontend\Controller\ErrorController;
use TYPO3\CMS\Seo\XmlSitemap\Exception\InvalidConfigurationException;
/**
* Class to render the XML Sitemap to be used as a UserFunction.
*
* @internal this class is not part of TYPO3's Core API.
*/
#[Autoconfigure(public: true)]
final readonly class XmlSitemapRenderer
{
public function __construct(
private TypoScriptService $typoScriptService,
private ErrorController $errorController,
private ViewFactoryInterface $viewFactory,
private PolicyRegistry $policyRegistry,
private SystemResourceFactory $resourceFactory,
private SystemResourcePublisherInterface $resourcePublisher,
) {}
/**
* @param string $_ unused, but needed as this is called via userfunc and passes a string as first parameter
* @param array $typoScriptConfiguration TypoScript configuration specified in USER Content Object
* @throws InvalidConfigurationException
*/
#[AsAllowedCallable]
public function render(string $_, array $typoScriptConfiguration, ServerRequestInterface $request): string
{
$settingsTree = $request->getAttribute('frontend.typoscript')->getSetupTree()->getChildByName('plugin')->getChildByName('tx_seo');
$configurationArrayWithoutDots = $this->typoScriptService->convertTypoScriptArrayToPlainArray($settingsTree->toArray());
$viewConfiguration = $configurationArrayWithoutDots['view'] ?? [];
$viewFactoryData = new ViewFactoryData(
templateRootPaths: $viewConfiguration['templateRootPaths'] ?? [],
partialRootPaths: $viewConfiguration['partialRootPaths'] ?? [],
layoutRootPaths: $viewConfiguration['layoutRootPaths'] ?? [],
request: $request,
format: 'xml',
);
$view = $this->viewFactory->create($viewFactoryData);
$sitemapType = $typoScriptConfiguration['sitemapType'] ?? 'xmlSitemap';
$view->assign('type', $request->getAttribute('routing')->getPageType());
$view->assign('sitemapType', $sitemapType);
$configConfiguration = $configurationArrayWithoutDots['config'] ?? [];
if (!empty($sitemapName = ($request->getQueryParams()['tx_seo']['sitemap'] ?? null))) {
$xslResource = $this->getXslResource($configConfiguration, $sitemapType, $sitemapName);
$this->applyDynamicContentSecurityPolicy($xslResource);
$view->assign('xslFile', (string)$this->resourcePublisher->generateUri($xslResource, $request));
return $this->renderSitemap($request, $view, $configConfiguration, $sitemapType, $sitemapName);
}
$xslResource = $this->getXslResource($configConfiguration, $sitemapType);
$this->applyDynamicContentSecurityPolicy($xslResource);
$view->assign('xslFile', (string)$this->resourcePublisher->generateUri($xslResource, $request));
return $this->renderIndex($request, $view, $configConfiguration, $sitemapType);
}
private function renderIndex(ServerRequestInterface $request, ViewInterface $view, array $configConfiguration, string $sitemapType): string
{
$sitemaps = [];
foreach ($configConfiguration[$sitemapType]['sitemaps'] as $sitemapName => $sitemapConfig) {
$sitemapProvider = $sitemapConfig['provider'] ?? null;
if (is_string($sitemapName)
&& is_string($sitemapProvider)
&& class_exists($sitemapProvider)
&& is_subclass_of($sitemapProvider, XmlSitemapDataProviderInterface::class)
) {
/** @var XmlSitemapDataProviderInterface $provider */
$provider = GeneralUtility::makeInstance($sitemapProvider, $request, $sitemapName, $sitemapConfig['config'] ?? []);
$pages = $provider->getNumberOfPages();
for ($page = 0; $page < $pages; $page++) {
$sitemaps[] = [
'key' => $sitemapName,
'page' => $page,
'lastMod' => $provider->getLastModified(),
];
}
}
}
$view->assign('sitemaps', $sitemaps);
return $view->render('Index');
}
private function renderSitemap(ServerRequestInterface $request, ViewInterface $view, array $configConfiguration, string $sitemapType, string $sitemapName): string
{
$sitemapConfig = $configConfiguration[$sitemapType]['sitemaps'][$sitemapName] ?? null;
if ($sitemapConfig) {
$sitemapProvider = $sitemapConfig['provider'] ?? null;
if (is_string($sitemapProvider)
&& class_exists($sitemapProvider)
&& is_subclass_of($sitemapProvider, XmlSitemapDataProviderInterface::class)
) {
/** @var XmlSitemapDataProviderInterface $provider */
$provider = GeneralUtility::makeInstance($sitemapProvider, $request, $sitemapName, $sitemapConfig['config'] ?? []);
$items = $provider->getItems();
$view->assign('items', $items);
$template = $sitemapConfig['config']['template'] ?? $sitemapConfig['template'] ?? 'Sitemap';
return $view->render($template);
}
throw new InvalidConfigurationException('No valid provider set for ' . $sitemapName, 1535578522);
}
throw new PropagateResponseException(
$this->errorController->pageNotFoundAction(
$request,
'No valid configuration found for sitemap ' . $sitemapName
),
1535578569
);
}
/**
* @throws CanNotResolvePublicResourceException
* @throws CanNotResolveSystemResourceException
*/
private function getXslResource(array $configConfiguration, string $sitemapType, ?string $sitemapName = null): PublicResourceInterface&SystemResourceInterface
{
$resourceIdentifier = $configConfiguration[$sitemapType]['sitemaps'][$sitemapName ?? '']['config']['xslFile']
?? $configConfiguration[$sitemapType]['sitemaps']['xslFile']
?? $configConfiguration['xslFile']
?? 'EXT:seo/Resources/Public/CSS/Sitemap.xsl';
$xslResource = $this->resourceFactory->createPublicResource($resourceIdentifier);
if (!$xslResource instanceof SystemResourceInterface) {
throw new \InvalidArgumentException('Can not resolve xslFile "%s" to a system resource', 1761032332);
}
return $xslResource;
}
/**
* Applies `Content-Security-Policy` mutations for `unsafe-hashes` for XSLT styles.
* This is done dynamically, since XSLT styles might change some day...
*
* The expected hash for the default XSLT styles is `sha256-d0ax6zoVJBeBpy4l3O2FJ6Y1L4SalCWw2x62uoJH15k=`.
*/
private function applyDynamicContentSecurityPolicy(SystemResourceInterface $xslResource): void
{
try {
$dom = new \DOMDocument();
$dom->loadXML($xslResource->getContents());
} catch (SystemResourceDoesNotExistException) {
return;
}
$hashes = [];
foreach ($dom->getElementsByTagName('style') as $node) {
if ($node->getAttribute('type') !== 'text/css') {
continue;
}
$hashes[] = HashValue::hash($node->textContent);
}
if ($hashes === []) {
return;
}
$this->policyRegistry->appendMutationCollection(
new MutationCollection(
new Mutation(
MutationMode::Extend,
Directive::StyleSrcElem,
...$hashes
)
)
);
}
}
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
return [
'seo' => [
'title' => 'LLL:EXT:seo/Resources/Private/Language/locallang_dashboard.xlf:widget.group.seo',
],
];
+38
View File
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Seo;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Reference;
use TYPO3\CMS\Backend\View\BackendViewFactory;
use TYPO3\CMS\Dashboard\WidgetRegistry;
use TYPO3\CMS\Seo\Widgets\PagesWithoutDescriptionWidget;
use TYPO3\CMS\Seo\Widgets\Provider\PagesWithoutDescriptionDataProvider;
return function (ContainerConfigurator $configurator, ContainerBuilder $containerBuilder) {
$services = $configurator->services();
/**
* Check if WidgetRegistry is defined, which means that EXT:dashboard is available.
* Registration directly in Services.yaml will break without EXT:dashboard installed!
*/
if ($containerBuilder->hasDefinition(WidgetRegistry::class)) {
$services->set('dashboard.widget.pagesWithoutMetaDescription')
->class(PagesWithoutDescriptionWidget::class)
->arg('$dataProvider', new Reference(PagesWithoutDescriptionDataProvider::class))
->arg('$backendViewFactory', new Reference(BackendViewFactory::class))
->arg('$options', ['refreshAvailable' => true])
->tag('dashboard.widget', [
'identifier' => 'seo-pagesWithoutMetaDescription',
'groupNames' => 'seo',
'title' => 'LLL:EXT:seo/Resources/Private/Language/locallang_dashboard.xlf:widget.pagesWithoutMetaDescription.title',
'description' => 'LLL:EXT:seo/Resources/Private/Language/locallang_dashboard.xlf:widget.pagesWithoutMetaDescription.description',
'iconIdentifier' => 'content-widget-list',
'height' => 'large',
'width' => 'medium',
]);
}
};
+13
View File
@@ -0,0 +1,13 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false
TYPO3\CMS\Seo\:
resource: '../Classes/*'
TYPO3\CMS\Seo\Widgets\Provider\PagesWithoutDescriptionDataProvider:
arguments:
$excludedDoktypes: [ 3, 4, 6, 7, 199, 254 ]
$limit: 8
+1
View File
@@ -0,0 +1 @@
name: typo3/seo-sitemap
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:seo/Configuration/Sets/Sitemap/labels.xlf" date="2018-09-04T12:30:00Z" product-name="seo">
<header/>
<body>
<trans-unit id="label">
<source>SEO Sitemap</source>
</trans-unit>
<trans-unit id="categories.seo">
<source>SEO Sitemap</source>
</trans-unit>
<trans-unit id="categories.seo.templates">
<source>Template Paths</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.view.templateRootPath">
<source>Path to template root (FE)</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.view.partialRootPath">
<source>Path to template partials (FE)</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.view.layoutRootPath">
<source>Path to template layouts (FE)</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.pages.excludedDoktypes">
<source>Doktypes to exclude</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.pages.excludePagesRecursive">
<source>List of page uids which should be excluded recursive</source>
</trans-unit>
<trans-unit id="settings.seo.sitemap.pages.additionalWhere">
<source>Additional where clause</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,15 @@
routeEnhancers:
PageTypeSuffix:
type: PageType
map:
sitemap.xml: 1533906435
Sitemap:
type: Simple
routePath: 'sitemap-type/{sitemap}'
aspects:
sitemap:
type: StaticValueMapper
map:
pages: pages
_arguments:
sitemap: 'tx_seo/sitemap'
@@ -0,0 +1,30 @@
categories:
seo: ~
seo.templates:
parent: seo
settings:
seo.sitemap.view.templateRootPath:
default: 'EXT:seo/Resources/Private/Templates/'
type: string
category: seo.templates
seo.sitemap.view.partialRootPath:
default: 'EXT:seo/Resources/Private/Partials/'
type: string
category: seo.templates
seo.sitemap.view.layoutRootPath:
default: 'EXT:seo/Resources/Private/Layouts/'
type: string
category: seo.templates
seo.sitemap.pages.excludedDoktypes:
default: '3, 4, 6, 7, 199, 254'
type: string
category: seo
seo.sitemap.pages.excludePagesRecursive:
default: ''
type: string
category: seo
seo.sitemap.pages.additionalWhere:
default: "{#no_index} = 0 AND {#canonical_link} = ''"
type: string
category: seo
@@ -0,0 +1 @@
@import 'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript'
+270
View File
@@ -0,0 +1,270 @@
<?php
defined('TYPO3') or die();
$openGraphCropConfiguration = [
'config' => [
'cropVariants' => [
'default' => [
'disabled' => true,
],
'social' => [
'title' => 'core.wizards:imwizard.crop_variant.social',
'coverAreas' => [],
'cropArea' => [
'x' => '0.0',
'y' => '0.0',
'width' => '1.0',
'height' => '1.0',
],
'allowedAspectRatios' => [
'1.91:1' => [
'title' => 'core.wizards:imwizard.ratio.191_1',
'value' => 1200 / 630,
],
'NaN' => [
'title' => 'core.wizards:imwizard.ratio.free',
'value' => 0.0,
],
],
'selectedRatio' => '1.91:1',
],
],
],
];
$tca = [
'palettes' => [
'seo' => [
'label' => 'core.form.palettes:seo',
'showitem' => 'seo_title',
],
'robots' => [
'label' => 'core.form.palettes:robots',
'showitem' => 'no_index, no_follow',
],
'canonical' => [
'label' => 'core.form.palettes:canonical',
'showitem' => 'canonical_link',
],
'sitemap' => [
'label' => 'core.form.palettes:sitemap',
'showitem' => 'sitemap_changefreq, sitemap_priority',
],
'opengraph' => [
'label' => 'core.form.palettes:opengraph',
'showitem' => 'og_title, --linebreak--, og_description, --linebreak--, og_image',
],
'twittercards' => [
'label' => 'core.form.palettes:twittercards',
'showitem' => 'twitter_title, --linebreak--, twitter_description, --linebreak--, twitter_image, --linebreak--, twitter_card',
],
],
'columns' => [
'seo_title' => [
'exclude' => true,
'l10n_mode' => 'prefixLangTitle',
'label' => 'seo.db:pages.seo_title',
'config' => [
'type' => 'input',
'size' => 40,
'max' => 255,
'eval' => 'trim',
],
],
'no_index' => [
'exclude' => true,
'l10n_mode' => 'exclude',
'onChange' => 'reload',
'label' => 'seo.db:pages.no_index_formlabel',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
'label' => '',
'invertStateDisplay' => true,
],
],
],
],
'no_follow' => [
'exclude' => true,
'l10n_mode' => 'exclude',
'label' => 'seo.db:pages.no_follow_formlabel',
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'items' => [
[
'label' => '',
'invertStateDisplay' => true,
],
],
],
],
'sitemap_changefreq' => [
'exclude' => true,
'label' => 'seo.db:pages.sitemap_changefreq',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['label' => 'seo.db:pages.sitemap_changefreq.none', 'value' => ''],
['label' => 'seo.db:pages.sitemap_changefreq.always', 'value' => 'always'],
['label' => 'seo.db:pages.sitemap_changefreq.hourly', 'value' => 'hourly'],
['label' => 'seo.db:pages.sitemap_changefreq.daily', 'value' => 'daily'],
['label' => 'seo.db:pages.sitemap_changefreq.weekly', 'value' => 'weekly'],
['label' => 'seo.db:pages.sitemap_changefreq.monthly', 'value' => 'monthly'],
['label' => 'seo.db:pages.sitemap_changefreq.yearly', 'value' => 'yearly'],
['label' => 'seo.db:pages.sitemap_changefreq.never', 'value' => 'never'],
],
'dbFieldLength' => 10,
],
],
'sitemap_priority' => [
'exclude' => true,
'label' => 'seo.db:pages.sitemap_priority',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'default' => '0.5',
'items' => [
['label' => '0.0', 'value' => '0.0'],
['label' => '0.1', 'value' => '0.1'],
['label' => '0.2', 'value' => '0.2'],
['label' => '0.3', 'value' => '0.3'],
['label' => '0.4', 'value' => '0.4'],
['label' => '0.5', 'value' => '0.5'],
['label' => '0.6', 'value' => '0.6'],
['label' => '0.7', 'value' => '0.7'],
['label' => '0.8', 'value' => '0.8'],
['label' => '0.9', 'value' => '0.9'],
['label' => '1.0', 'value' => '1.0'],
],
],
],
'canonical_link' => [
'exclude' => true,
'label' => 'seo.db:pages.canonical_link',
'description' => 'seo.db:pages.canonical_link.description',
'displayCond' => 'FIELD:no_index:=:0',
'config' => [
'type' => 'link',
'allowedTypes' => ['page', 'url', 'record'],
'size' => 50,
'appearance' => [
'browserTitle' => 'seo.db:pages.canonical_link',
'allowedOptions' => ['params'],
],
],
],
'og_title' => [
'exclude' => true,
'l10n_mode' => 'prefixLangTitle',
'label' => 'seo.db:pages.og_title',
'config' => [
'type' => 'input',
'size' => 40,
'max' => 255,
'eval' => 'trim',
],
],
'og_description' => [
'exclude' => true,
'l10n_mode' => 'prefixLangTitle',
'label' => 'seo.db:pages.og_description',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 3,
],
],
'og_image' => [
'exclude' => true,
'label' => 'seo.db:pages.og_image',
'config' => [
'type' => 'file',
'allowed' => 'common-image-types',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'overrideChildTca' => [
'columns' => [
'crop' => $openGraphCropConfiguration,
],
],
],
],
'twitter_title' => [
'exclude' => true,
'l10n_mode' => 'prefixLangTitle',
'label' => 'seo.db:pages.twitter_title',
'config' => [
'type' => 'input',
'size' => 40,
'max' => 255,
'eval' => 'trim',
],
],
'twitter_description' => [
'exclude' => true,
'l10n_mode' => 'prefixLangTitle',
'label' => 'seo.db:pages.twitter_description',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 3,
],
],
'twitter_image' => [
'exclude' => true,
'label' => 'seo.db:pages.twitter_image',
'config' => [
'type' => 'file',
'allowed' => 'common-image-types',
'behaviour' => [
'allowLanguageSynchronization' => true,
],
'overrideChildTca' => [
'columns' => [
'crop' => $openGraphCropConfiguration,
],
],
],
],
'twitter_card' => [
'exclude' => true,
'label' => 'seo.db:pages.twitter_card',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'default' => '',
'items' => [
['label' => '', 'value' => ''],
['label' => 'seo.db:pages.twitter_card.summary', 'value' => 'summary'],
['label' => 'seo.db:pages.twitter_card.summary_large_image', 'value' => 'summary_large_image'],
],
'dbFieldLength' => 255,
],
],
],
];
$GLOBALS['TCA']['pages'] = array_replace_recursive($GLOBALS['TCA']['pages'], $tca);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'
--div--;core.form.tabs:seo,
--palette--;;seo,
--palette--;;robots,
--palette--;;canonical,
--palette--;;sitemap,
--div--;core.form.tabs:socialmedia,
--palette--;;opengraph,
--palette--;;twittercards',
(string)\TYPO3\CMS\Core\Domain\Repository\PageRepository::DOKTYPE_DEFAULT,
'after:title'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette('pages', 'seo', '--linebreak--, description', 'after:seo_title');
@@ -0,0 +1,9 @@
<?php
defined('TYPO3') or die();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'seo',
'Configuration/TypoScript/XmlSitemap',
'XML Sitemap'
);
@@ -0,0 +1,27 @@
# customsubcategory=sitemap=XML Sitemap
plugin.tx_seo {
view {
# cat=plugin.tx_seo/file; type=string; label=Path to template root (FE)
templateRootPath = EXT:seo/Resources/Private/Templates/
# cat=plugin.tx_seo/file; type=string; label=Path to template partials (FE)
partialRootPath = EXT:seo/Resources/Private/Partials/
# cat=plugin.tx_seo/file; type=string; label=Path to template layouts (FE)
layoutRootPath = EXT:seo/Resources/Private/Layouts/
}
settings {
xmlSitemap {
sitemaps {
pages {
# cat=plugin.tx_seo/sitemap; type=string; label=Doktypes to exclude
excludedDoktypes = 3, 4, 6, 7, 199, 254
# cat=plugin.tx_seo/sitemap; type=string; label=List of page uids which should be excluded recursive
excludePagesRecursive =
# cat=plugin.tx_seo/sitemap; type=string; label=Additional where clause
additionalWhere = {#no_index} = 0 AND {#canonical_link} = ''
}
}
}
}
}
@@ -0,0 +1,60 @@
seo_sitemap = PAGE
seo_sitemap {
typeNum = 1533906435
config {
cache_period = 900
disableAllHeaderCode = 1
admPanel = 0
removeDefaultJS = 1
removeDefaultCss = 1
additionalHeaders {
10.header = Content-Type:application/xml;charset=utf-8
20.header = X-Robots-Tag:noindex
}
# Prevent sitemap.xml from appearing in the search results of EXT:indexed_search
index_enable = 0
}
10 = USER
10.userFunc = TYPO3\CMS\Seo\XmlSitemap\XmlSitemapRenderer->render
}
plugin.tx_seo {
view {
templateRootPaths {
0 = EXT:seo/Resources/Private/Templates/XmlSitemap
10 = {$plugin.tx_seo.view.templateRootPath ?? $seo.sitemap.view.templateRootPath}
}
partialRootPaths {
0 = EXT:seo/Resources/Private/Partials/XmlSitemap
10 = {$plugin.tx_seo.view.partialRootPath ?? $seo.sitemap.view.partialRootPath}
}
layoutRootPaths {
0 = EXT:seo/Resources/Private/Layouts/XmlSitemap
10 = {$plugin.tx_seo.view.layoutRootPath ?? $seo.sitemap.view.layoutRootPath}
}
}
config {
# Here you can override the xslFile for all sitemaps
# xslFile = EXT:seo/Resources/Public/CSS/Sitemap.xsl
xmlSitemap {
sitemaps {
# Here you can override the xslFile for all sitemaps of a certain sitemapType
# xslFile = EXT:seo/Resources/Public/CSS/Sitemap.xsl
pages {
provider = TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider
config {
# Here you can override the xslFile for a single sitemap
# xslFile = EXT:seo/Resources/Public/CSS/Sitemap.xsl
excludedDoktypes = {$plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.excludedDoktypes ?? $seo.sitemap.pages.excludedDoktypes}
# comma-separated list of page uids which should be excluded recursive
excludePagesRecursive = {$plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.excludePagesRecursive ?? $seo.sitemap.pages.excludePagesRecursive}
additionalWhere = {$plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.additionalWhere ?? $seo.sitemap.pages.additionalWhere}
}
}
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
mod.web_info.fieldDefinitions {
seo {
label = LLL:EXT:seo/Resources/Private/Language/locallang_webinfo.xlf:seo
fields = title,uid,slug,seo_title,description,no_index,no_follow,canonical_link,sitemap_changefreq,sitemap_priority
}
social_media {
label = LLL:EXT:seo/Resources/Private/Language/locallang_webinfo.xlf:social_media
fields = title,uid,og_title,og_description,twitter_title,twitter_description
}
}
+51
View File
@@ -0,0 +1,51 @@
.. include:: /Includes.rst.txt
.. _configuration:
=============
Configuration
=============
Target group: **Developers, Integrators**
.. seealso::
General SEO recommendations for TypoScript and Site Configuration can be
found in `TYPO3 explained, Suggested configuration options for improved
SEO in TYPO3 <https://docs.typo3.org/permalink/t3coreapi:seo-configuration>`_.
.. toctree::
:caption: Subpages
:glob:
*
.. _configuration-site-sets:
Site sets
=========
.. versionadded::13.3
EXT:seo now offers a site set "SEO Sitemap" to include the TypoScript to
output the XML sitemap.
Include the site set "SEO Sitemap", `typo3/seo-sitemap` via the :ref:`site set in the site
configuration <t3coreapi:site-sets>` or the custom
:ref:`site package's site set <t3sitepackage:site_set>`.
Settings for the included set can be adjusted in the :ref:`settings-editor`.
.. figure:: /Images/SiteSet.png
Add the site set "SEO Sitemap"
This will change your site configuration file as follows:
.. literalinclude:: _site_config.diff
:caption: config/sites/my-site/config.yaml (diff)
If your site has a custom :ref:`site package <t3sitepackage:start>`, you
can also add the "SEO Sitemap" set as dependency in your site's configuration:
.. literalinclude:: _site_package_set.diff
:caption: EXT:my_site_package/Configuration/Sets/MySite/config.yaml (diff)
+28
View File
@@ -0,0 +1,28 @@
:navigation-title: Settings
.. include:: /Includes.rst.txt
.. _configuration-site-set-settings:
=============================
Site sets settings of EXT:seo
=============================
The following settings are available via the
:ref:`site set settings <configuration-site-sets>` and can be adjusted in
the :ref:`settings-editor`.
.. versionchanged:: 14.0
The names of the GET parameters used in the sitemap generated by EXT:seo have
been changed from `page` and `sitemap` to `tx_seo[page]` and `tx_seo[sitemap]`
respectively. If you are overriding the templates for the sitemap, provide
separate sets for TYPO3 13.4 and 14.x support.
.. versionchanged:: 14.1
The site set `typo3/seo-sitemap` now ships a sitemap route enhancer. See
also `Automatic routing for the XML sitemap <https://docs.typo3.org/permalink/typo3/cms-seo:xmlsitemap-routing>`_.
.. typo3:site-set-settings:: PROJECT:/Configuration/Sets/Sitemap/settings.definitions.yaml
:name: seo-settings
:type:
:Label: Settings of the site set of EXT:seo
@@ -0,0 +1,23 @@
.. include:: /Includes.rst.txt
.. _settings-editor:
===============
Settings editor
===============
When the :ref:`site set for the SEO sitemap <configuration-site-sets>` is included,
the settings for sitemaps become available in the editor:
You can find the available site settings in module
:guilabel:`Sites > Setup > Settings`
You can change individual settings here. If the site settings are writable
you can hit the :guilabel:`Save` button and the settings will be written
directly to the site settings.
If the settings are not writable you can click the :guilabel:`YAML export`
button to export the settings. These can then be added by a developer with
sufficient rights.
The available settings are also described in detail in :ref:`site-sets`.
@@ -0,0 +1,5 @@
base: 'https://example.com/'
rootPageId: 1
dependencies:
- typo3/fluid-styled-content-css
+ - typo3/seo-sitemap
@@ -0,0 +1,9 @@
name: my-vendor/my-site-package
label: My Site Package Set
settings:
website:
background:
color: '#386492'
dependencies:
- typo3/fluid-styled-content-css
+ - typo3/seo-sitemap
+15
View File
@@ -0,0 +1,15 @@
.. include:: /Includes.rst.txt
.. _developer:
================
Developer Corner
================
When you work with a pages-only approach you most likely don't need to use the meta tag APIs. If you have a special
edge-case or have a detail view to show a record, you need the APIs to render the corresponding meta information for your
page. You can refer to the documentation of the following APIs:
- The MetaTagApi (see :ref:`t3coreapi:metatagapi`) to define what metatags should be rendered on your page
- The PageTitleAPI (see :ref:`t3coreapi:pagetitle`) will give you the possibility to set the title of the page
+152
View File
@@ -0,0 +1,152 @@
:navigation-title: Features
.. include:: /Includes.rst.txt
.. _features:
============================================
Features of the TYPO3 system extension "seo"
============================================
The TYPO3 system extension :composer:`typo3/cms-seo` offers multiple tools and
fields that can be used to improve visibility of a TYPO3 site in search engines:
.. contents::
.. toctree::
:glob:
:hidden:
*
.. _seo-page-properties:
Additional tabs "SEO" and "Social media" in the page properties
===============================================================
After `Installation <https://docs.typo3.org/permalink/typo3/cms-seo:installation>`_
two additional tabs are available in the page properties.
SEO
This tab contains additional fields for the
`title tag <https://docs.typo3.org/permalink/typo3/cms-seo:seo-page-title-provider>`_
in the HTML header, for the description meta tag, for robots instruction, the
`Canonical URL <https://docs.typo3.org/permalink/typo3/cms-seo:canonical-url>`_
and for priorities used in the
`XML Sitemap <https://docs.typo3.org/permalink/typo3/cms-seo:xml-sitemap>`_.
Social media
This tab contains additional fields to manage data for the
Open Graph (Facebook) meta tags and the X / Twitter Cards.
Usage of these additional fields is described in the Editors Tutorial,
`Search engine optimization (SEO) for TYPO3 editors <https://docs.typo3.org/permalink/t3editors:seo>`_.
.. _seo-page-dashboard:
A Dashboard Widget for SEO
==========================
The extension also offers an additional Dashboard widget.
:composer:`typo3/cms-dashboard` needs to be installed. Usage is described in
the Editors Tutorial, chapter
`Dashboard widgets for Search engine optimization (SEO) in TYPO3 <https://docs.typo3.org/permalink/t3editors:dashboard-widgets>`_.
If your editors have one of the standard user groups "Editor" or "Advanced Editor",
created by the command `typo3 setup:begroups:default` they have permissions to
use the widget.
If you created the use groups manually you users need to have "Dashboard" in
their allowed modules and "Pages missing Meta Description" in the
allowed dashboard widgets list:
`Dashboard manual, permissions of widgets <https://docs.typo3.org/permalink/typo3/cms-dashboard:permission-handling-of-widgets>`_
.. _xml-sitemap:
XML Sitemap
===========
The extension :composer:`typo3/cms-seo` comes with the site set
`typo3/seo-sitemap <https://docs.typo3.org/permalink/typo3/cms-seo:configuration-site-sets>`_,
which you can use to provide an XML sitemap like `https://example.org/sitemap.xml`.
See chapter `XML sitemap <https://docs.typo3.org/permalink/typo3/cms-seo:xmlsitemap>`_
for details.
.. _canonical-url:
Canonical URL
=============
When :composer:`typo3/cms-seo` is installed, pages automatically contain a
canonical link tag in their HTML head, unless disabled via TypoScript.
.. code-block:: html
:caption: example output of a canonical link in the head of a TYPO3 page
<head>
<!-- ... -->
<link rel="canonical" href="https://example.org/somepage"/>
</head>
You can use the event `ModifyUrlForCanonicalTagEvent <https://docs.typo3.org/permalink/t3coreapi:modifyurlforcanonicaltagevent>`_
to provide an alternative canonical URL if needed.
The API of the canonical link is described in
`Canonical API, TYPO3 Explained <https://docs.typo3.org/permalink/t3coreapi:canonicalapi>`_.
.. warning::
If you have other SEO extensions installed that generate canonical links,
you have to make sure only one is responsible to embed into your frontend
output.
If both the Core and another extension are generating a canonical link,
it will result in 2 canonical links which might cause confusion for search
engines.
.. _seo-page-title-provider:
SEO page title provider
=======================
While the `Page title API <https://docs.typo3.org/permalink/t3coreapi:pagetitle>`_,
providing a `<title>` tag in the HTML head is part of a minimal TYPO3 installation,
:composer:`typo3/cms-seo` provides an additional field, `seo_title` in the page
properties. The :php:`\TYPO3\CMS\Seo\PageTitle\SeoTitlePageTitleProvider`
provides this title as an alternative title for the `<title>` tag.
The following default TypoScript setup is provided for the page title provider:
.. code-block:: typoscript
config.pageTitleProviders {
seo {
provider = TYPO3\CMS\Seo\PageTitle\SeoTitlePageTitleProvider
before = record
}
}
.. _seo-meta-tag-provider:
Additional meta tag handling
============================
While the `MetaTag API <https://docs.typo3.org/permalink/t3coreapi:metatagapi>`_
is part of the minimal TYPO3 Core, the meta tag providers for the description
meta tag commonly used for search engine optimazation, and the social preview
meta tags of Open Graph and Twitter / X are part of :composer:`typo3/cms-seo`.
.. _seo-hreflang:
Hreflang tags
=============
:html:`hreflang` link-tags are added automatically for multi-language websites
based on the one-tree principle.
The links are based on the site configuration and depend on translations of a page.
:html:`hreflang="x-default"` indicates the link of the current page in the default language.
The value of :html:`hreflang` is set for each language in
:guilabel:`Sites > Setup` (see :ref:`t3coreapi:sitehandling-addingLanguages`)
+243
View File
@@ -0,0 +1,243 @@
.. include:: /Includes.rst.txt
.. index:: XML sitemap
.. _xmlsitemap:
===========
XML sitemap
===========
:composer:`typo3/cms-seo` provides a ready to use XML sitemap that can be
included via `Site sets <https://docs.typo3.org/permalink/typo3/cms-seo:configuration-site-sets>`_
(recommended) or include in your TypoScript record.
.. versionchanged:: 14.0
The names of the GET parameters used in the sitemap generated by EXT:seo have
been changed from `page` and `sitemap` to `tx_seo[page]` and `tx_seo[sitemap]`
respectively.
If you are overriding the :ref:`automatic routing configuration <xmlsitemap-routing>`,
the customized routing needs to be slightly adopted.
If the templates of `EXT:seo/Resources/Private/Templates/XmlSitemap/Index.xml`
have been modified, adopt the generated links to fit the original ones.
In case the URL to a single sitemap has been provided to a third party tool
like a crawler, search engine, ... it must be added again with the new URL.
.. contents:: Table of Contents
:depth: 1
:local:
.. _xmlsitemap-url:
How to access your XML sitemap
==============================
You can access the sitemaps by visiting `https://example.org/sitemap.xml`.
You will first see the sitemap index. By default, there is one sitemap in the
index. This is the sitemap for pages.
.. note::
Each site root and language configured in the
`Site handling <https://docs.typo3.org/permalink/t3coreapi:sitehandling>`_
has its own XML sitemap depending on the entry point.
**Example:**
- Entry point `/` - :samp:`https://example.org/sitemap.xml`: for default language
- Entry point `/fr/` - :samp:`https://example.org/fr/sitemap.xml`: for French
- Entry point `/it/` - :samp:`https://example.org/it/sitemap.xml`: for Italian
.. _xmlsitemap-routing:
Automatic routing for the XML sitemap
=====================================
.. versionchanged:: 14.1
The SEO extension now ships its sitemap route enhancers as part of
the `typo3/seo-sitemap` site set.
Previously, these route enhancers had to be manually configured in each
site's `config.yaml`.
The SEO extension now ships its sitemap route enhancers as part of
the `typo3/seo-sitemap` site set. When this set is used as a dependency,
the route enhancers for XML sitemaps are automatically configured.
This enables clean URLs for sitemaps out of the box:
* `/sitemap.xml` - Main sitemap index
* `/sitemap-type/pages/sitemap.xml` - Pages sitemap
The routing can be overridden in the projects :file:`config/sites/my-site/config.yaml`
and in site sets extending the `typo3/seo-sitemap` site set.
.. index:: XmlSitemapDataProviders
.. _xmlsitemap-data-providers:
Data providers for XML sitemaps
===============================
The rendering of sitemaps is based on data providers implementing
:php:`\TYPO3\CMS\Seo\XmlSitemap\XmlSitemapDataProviderInterface`.
:composer:`typo3/cms-seo` ships with the following data providers for XML
sitemaps:
.. _xmlsitemap-data-providers-pages:
For pages: PagesXmlSitemapDataProvider
--------------------------------------
The :php:`\TYPO3\CMS\Seo\XmlSitemap\PagesXmlSitemapDataProvider` will generate a
sitemap of pages based on the detected site root. You can configure whether you
have additional conditions for selecting the pages.
Via setting :ref:`seo.sitemap.pages.excludedDoktypes <typo3/cms-seo:confval-seo-settings-seo-sitemap-pages-excludeddoktypes>`
it is possible to exclude certain `Types of pages <https://docs.typo3.org/permalink/t3coreapi:list-of-page-types>`_.
Additionally, you may exclude page subtrees from the sitemap
(for example internal pages). This can be
configured using setting
:ref:`seo.sitemap.pages.excludePagesRecursive <typo3/cms-seo:confval-seo-settings-seo-sitemap-pages-excludepagesrecursive>`.
If your site still depend on TypoScript records instead of site sets, you can
make these settings via TypoScript constants.
For special use cases you might want to override the default TypoScript provided
by the set.
.. _xmlsitemap-data-providers-records:
For database records: RecordsXmlSitemapDataProvider
---------------------------------------------------
If you have an extension installed and want a sitemap of those records, the
:php:`\TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider` can be used. The
following example shows how to add a sitemap for news records:
.. literalinclude:: _xmlSitemap/_record.typoscript
:caption: EXT:my_extension/Configuration/Sets/XmlSitemapNews/setup.typoscript
You can add multiple sitemaps and they will be added to the sitemap index
automatically. Use different types to have multiple, independent sitemaps:
.. literalinclude:: _xmlSitemap/_multiple.typoscript
:caption: EXT:my_extension/Configuration/Sets/XmlSitemapMultiple/setup.typoscript
.. _xmlsitemap-changefreq-priority:
Change frequency and priority
=============================
Change frequencies define how often each page is approximately updated and hence
how often it should be revisited (for example: News in an archive are "never"
updated, while your home page might get "weekly" updates).
Priority allows you to define how important the page is compared to other pages
on your site. The priority is stated in a value from 0 to 1. Your most important
pages can get an higher priority as other pages. This value does not affect how
important your pages are compared to pages of other websites. All pages and
records get a priority of 0.5 by default.
The settings can be defined in the TypoScript configuration of an XML sitemap by
mapping the properties to fields of the record by using the options
:typoscript:`changeFreqField` and :typoscript:`priorityField`.
:typoscript:`changeFreqField` needs to point to a field containing string values
(see :typoscript:`pages` TCA definition of field
:typoscript:`sitemap_changefreq`), :typoscript:`priorityField` needs to point to
a field with a decimal value between 0 and 1.
.. note::
Both the priority and the change frequency have no impact on your rankings.
These options only give hints to search engines in which order and how often
you would like a crawler to visit your pages.
.. _xmlsitemap-without-sorting:
Sitemap of records without sorting field
========================================
Sitemaps are paginated by default. To ensure that as few pages of the sitemap
as possible are changed after the number of records is changed, the items in the
sitemaps are ordered. By default, this is done using a sorting field. If you do
not have such a field, make sure to configure this in your sitemap configuration
and use a different field. An example you can use for sorting based on the uid
field:
.. literalinclude:: _xmlSitemap/_recordUnsorted.typoscript
:caption: EXT:my_extension/Configuration/Sets/XmlSitemapTableWithoutSorting/setup.typoscript
.. _xmlsitemap-custom-provider:
Create a custom XML sitemap provider
====================================
If you need more logic in your sitemap, you can also write your own
sitemap provider. You can do this by extending the
:php:`\TYPO3\CMS\Seo\XmlSitemap\AbstractXmlSitemapDataProvider` class or
implementing :php:`\TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider`.
The main methods of interest are :php:`getLastModified()` and :php:`getItems()`.
The :php:`getLastModified()` method is used in the sitemap index and has to
return the date of the last modified item in the sitemap.
The :php:`getItems()` method has to return an array with the items for the
sitemap:
.. code-block:: php
:caption: EXT:my_extension/Classes/XmlSitemap/MyXmlSitemapProvider.php
$this->items[] = [
'loc' => 'https://example.org/page1.html',
'lastMod' => '1536003609'
];
The :php:`loc` element is the URL of the page to be crawled by a search engine.
The :php:`lastMod` element contains the date of the last update of the
specific item. This value is a UNIX timestamp. In addition, you can include
:php:`changefreq` and :php:`priority` as keys in the array to give
:ref:`search engines a hint <xmlsitemap-changefreq-priority>`.
.. _sitemap-xslFile:
Use a customized sitemap XSL file
=================================
The XSL file used to create a layout for an XML sitemap can be configured at
three levels:
#. For all sitemaps:
.. code-block:: typoscript
:caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript
plugin.tx_seo.config {
xslFile = EXT:my_extension/Resources/Public/CSS/mySite.xsl
}
#. For all sitemaps of a certain sitemapType:
.. code-block:: typoscript
:caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript
plugin.tx_seo.config.mySitemapType.sitemaps {
xslFile = EXT:my_extension/Resources/Public/CSS/mySite.xsl
}
#. For a specific sitemap:
.. code-block:: typoscript
:caption: EXT:my_extension/Configuration/TypoScript/setup.typoscript
plugin.tx_seo.config.xmlSitemap.sitemaps.myNewsSitemap.config {
xslFile = EXT:my_extension/Resources/Public/CSS/mySite.xsl
}
The value is inherited until it is overwritten.
If no value is specified at all, :file:`EXT:seo/Resources/Public/CSS/Sitemap.xsl`
is used as default.
@@ -0,0 +1,18 @@
routeEnhancers:
PageTypeSuffix:
type: PageType
map:
/: 0
sitemap.xml: 1533906435
Sitemap:
type: Simple
routePath: 'sitemap-type/{sitemap}'
aspects:
sitemap:
type: StaticValueMapper
map:
pages: pages
tx_news: tx_news
my_other_sitemap: my_other_sitemap
_arguments:
sitemap: 'tx_seo/sitemap'
@@ -0,0 +1,30 @@
seo_googlenews < seo_sitemap
seo_googlenews.typeNum = 1571859552
seo_googlenews.10.sitemapType = googleNewsSitemap
plugin.tx_seo {
config {
xmlSitemap {
sitemaps {
news {
provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
config {
# ...
}
}
}
}
googleNewsSitemap {
sitemaps {
news {
provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
config {
googleNews = 1
# ...
template = GoogleNewsXmlSitemap.xml
}
}
}
}
}
}
@@ -0,0 +1,31 @@
plugin.tx_seo {
config {
xmlSitemap {
sitemaps {
myNewsSitemap {
provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
config {
table = news_table
sortField = sorting
lastModifiedField = tstamp
changeFreqField = news_changefreq
priorityField = news_priority
additionalWhere = AND ({#no_index} = 0 OR {#no_follow} = 0)
pid = <page id('s) containing news records>
recursive = <number of subpage levels taken into account beyond the pid page. (default: 0)>
url {
pageId = <your detail page id>
fieldToParameterMap {
uid = tx_extension_pi1[news]
}
additionalGetParameters {
tx_extension_pi1.controller = News
tx_extension_pi1.action = detail
}
}
}
}
}
}
}
}
@@ -0,0 +1,13 @@
plugin.tx_seo {
config {
xmlSitemap {
sitemaps {
myUnsortedTable {
config {
sortField = uid
}
}
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

+1
View File
@@ -0,0 +1 @@
.. You can put central messages to display on all pages here
+63
View File
@@ -0,0 +1,63 @@
.. include:: /Includes.rst.txt
.. _start:
================================
TYPO3 Search Engine Optimization
================================
:Extension key:
seo
:Package name:
typo3/cms-seo
:Version:
|release|
:Language:
en
:Author:
TYPO3 contributors
:License:
This document is published under the
`Open Content License <https://www.openhub.net/licenses/opl>`__.
:Rendered:
|today|
----
This extension offers special fields for search engine optimization (SEO)
purposes, HTML meta tags display and sitemaps.
General information on topics about SEO can be found in
:ref:`Search engine optimization (SEO) <t3coreapi:seo>`.
Information for editors, including how to use the
`dashboard widgets <https://docs.typo3.org/permalink/t3editors:dashboard-widgets>`_
can be found in
`Tutorial for Editors, Search engine optimization (SEO) for TYPO3 editors <https://docs.typo3.org/permalink/t3editors:seo>`_.
----
**Table of Contents:**
.. toctree::
:maxdepth: 2
:titlesonly:
Introduction/Index
Installation/Index
Features/Index
Configuration/Index
Developer/Index
.. Meta Menu
.. toctree::
:hidden:
Sitemap
+54
View File
@@ -0,0 +1,54 @@
.. include:: /Includes.rst.txt
.. _installation:
============
Installation
============
Target group: **Administrators**
This extension is part of the TYPO3 Core.
.. contents:: Table of contents
:local:
Installation with Composer
==========================
Check whether you are already using the extension with:
.. code-block:: bash
composer show | grep seo
This should either give you no result or something similar to:
.. code-block:: none
typo3/cms-seo v12.4.11
If it is not installed yet, use the ``composer require`` command to install
the extension:
.. code-block:: bash
composer require typo3/cms-seo
The given version depends on the version of the TYPO3 Core you are using.
Installation without Composer
=============================
In an installation without Composer, the extension is already shipped but might
not be activated yet. Activate it as follows:
#. In the backend, navigate to the :guilabel:`System > Extensions`
module.
#. Click the :guilabel:`Activate` icon for the SEO extension.
.. figure:: /Images/InstallActivate.png
:class: with-border
:alt: Extension manager showing SEO extension
Extension manager showing SEO extension
+29
View File
@@ -0,0 +1,29 @@
.. include:: /Includes.rst.txt
.. _introduction:
============
Introduction
============
The goal of the Core extension :composer:`typo3/cms-seo` is to make sure basic
technical Search Engine Optimization (SEO) is done right out of the box.
Specific fields for SEO purposes are added, as well as the rendering of HTML
meta tags in the frontend.
There are several things you can do to optimize your site for search engines.
Some tasks are only solvable with good human writers, others are technical
tasks, which need to be implemented.
The goal of the extension `seo` is to help you with the following parts of
your SEO journey.
* Give editors all the fields needed to set the necessary meta tags.
* Provide the rendering of meta tags in the frontend for SEO related
information, to avoid reimplementing it again and again.
* Provide stable APIs for developers to give them the chance to change the
behaviour when needed in edge cases.
For a list of the features provided by this extension see
`Features of the TYPO3 system extension "seo" <https://docs.typo3.org/permalink/typo3/cms-seo:features>`_.
+9
View File
@@ -0,0 +1,9 @@
:template: sitemap.html
.. include:: /Includes.rst.txt
=======
Sitemap
=======
.. The sitemap.html template will insert here the page tree automatically.
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<guides xmlns="https://www.phpdoc.org/guides" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides ../vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
links-are-relative="true">
<extension class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
project-home="https://extensions.typo3.org/extension/seo/"
project-contact="https://typo3.slack.com/archives/C025BQLFA"
project-repository="https://github.com/typo3/typo3"
project-issues="https://forge.typo3.org/projects/typo3cms-core/issues"
edit-on-github-branch="main"
edit-on-github="typo3/typo3"
edit-on-github-directory="typo3/sysext/seo/Documentation/"
typo3-core-preferred="main"
interlink-shortcode="typo3/cms-seo"
/>
<project title="SEO"
release="main (development)"
version="main (development)"
copyright="since 2018 by the TYPO3 contributors"
/>
</guides>
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
+11
View File
@@ -0,0 +1,11 @@
=======================
TYPO3 extension ``seo``
=======================
This extension offers special fields for SEO purposes, HTML meta tags display
and sitemaps.
:Repository: https://github.com/typo3/typo3
:Issues: https://forge.typo3.org/
:Read online: https://docs.typo3.org/c/typo3/cms-seo/main/en-us/
:Packagist: https://packagist.org/packages/typo3/cms-seo
+86
View File
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:seo/Resources/Private/Language/db.xlf" date="2018-08-09T16:22:32Z" product-name="seo">
<header/>
<body>
<trans-unit id="pages.seo_title">
<source>Title for search engines</source>
</trans-unit>
<trans-unit id="pages.no_index">
<source>No index</source>
</trans-unit>
<trans-unit id="pages.no_index_formlabel">
<source>Index this page</source>
</trans-unit>
<trans-unit id="pages.no_follow">
<source>No follow</source>
</trans-unit>
<trans-unit id="pages.no_follow_formlabel">
<source>Follow this page</source>
</trans-unit>
<trans-unit id="pages.og_title">
<source>Open Graph Title</source>
</trans-unit>
<trans-unit id="pages.og_description">
<source>Open Graph Description</source>
</trans-unit>
<trans-unit id="pages.og_image">
<source>Open Graph Image</source>
</trans-unit>
<trans-unit id="pages.twitter_title">
<source>X / Twitter Title</source>
</trans-unit>
<trans-unit id="pages.twitter_description">
<source>X / Twitter Description</source>
</trans-unit>
<trans-unit id="pages.twitter_image">
<source>X / Twitter Image</source>
</trans-unit>
<trans-unit id="pages.twitter_card">
<source>Type of card to show</source>
</trans-unit>
<trans-unit id="pages.twitter_card.summary">
<source>Summary Card</source>
</trans-unit>
<trans-unit id="pages.twitter_card.summary_large_image">
<source>Summary Card with a large image</source>
</trans-unit>
<trans-unit id="pages.canonical_link">
<source>Canonical link</source>
</trans-unit>
<trans-unit id="pages.canonical_link.description">
<source>A canonical URL is the URL of a page that search engines are advised to choose as the most representative from a set of duplicate pages. Often called deduplication, this process helps search engines show only one version of the otherwise duplicate content in its search results. TYPO3 automatically sets this to the most likely URL of the page if not set explicitly - which is most likely the URL of the page itself. If set here, the page will be removed from the XML sitemap.</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq">
<source>Change frequency</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.none">
<source>None</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.always">
<source>Always</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.hourly">
<source>Hourly</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.daily">
<source>Daily</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.weekly">
<source>Weekly</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.monthly">
<source>Monthly</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.yearly">
<source>Yearly</source>
</trans-unit>
<trans-unit id="pages.sitemap_changefreq.never">
<source>Never</source>
</trans-unit>
<trans-unit id="pages.sitemap_priority">
<source>Priority</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:seo/Resources/Private/Language/locallang_dashboard.xlf" date="2023-01-16T14:00:42Z" product-name="seo">
<header/>
<body>
<trans-unit id="widget.group.seo">
<source>SEO</source>
</trans-unit>
<trans-unit id="widget.pagesWithoutMetaDescription.title">
<source>Pages missing meta description</source>
</trans-unit>
<trans-unit id="widget.pagesWithoutMetaDescription.description">
<source>Find and display pages with missing meta description</source>
</trans-unit>
<trans-unit id="widget.pagesWithoutMetaDescription.noMissingDescriptions">
<source>All pages have a proper meta description — everything looks good.</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="EXT:seo/Resources/Private/Language/locallang_webinfo.xlf" date="2020-02-18T22:02:42Z" product-name="cms">
<header/>
<body>
<trans-unit id="seo">
<source>SEO</source>
</trans-unit>
<trans-unit id="social_media">
<source>Social Media</source>
</trans-unit>
</body>
</file>
</xliff>
@@ -0,0 +1,41 @@
<html
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Widget/Widget"/>
<f:section name="main">
<f:if condition="!{pages}">
<f:then>
<f:translate key="LLL:EXT:seo/Resources/Private/Language/locallang_dashboard.xlf:widget.pagesWithoutMetaDescription.noMissingDescriptions" />
</f:then>
<f:else>
<div class="widget-table-wrapper">
<table class="widget-table table table-striped table-hover">
<f:for each="{pages}" as="page">
<tr>
<td>
<strong>{page.title}</strong>
<br/>
{page.frontendUrl}
</td>
<td class="text-end">
<div class="btn-group">
<a href="{page.frontendUrl}" target="_blank" class="btn btn-default">
<core:icon identifier="actions-eye" alternativeMarkupIdentifier="inline"/>
</a>
<be:link.editRecord uid="{page.uid}" table="pages" module="web_layout" fields="description" returnUrl="{be:moduleLink(route: 'dashboard')}" class="btn btn-default">
<core:icon identifier="actions-open" alternativeMarkupIdentifier="inline"/>
</be:link.editRecord>
</div>
</td>
</tr>
</f:for>
</table>
</div>
</f:else>
</f:if>
</f:section>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="{xslFile}"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<f:for each="{sitemaps}" as="sitemap">
<sitemap>
<f:spaceless>
<f:if condition="{sitemap.page}">
<f:then><loc><f:uri.typolink parameter="t3://page?uid=current&type={type}&tx_seo[sitemap]={sitemap.key}&tx_seo[page]={sitemap.page}" absolute="true" /></loc></f:then>
<f:else><loc><f:uri.typolink parameter="t3://page?uid=current&type={type}&tx_seo[sitemap]={sitemap.key}" absolute="true" /></loc></f:else>
</f:if>
</f:spaceless>
<lastmod>{sitemap.lastMod -> f:format.date(format: 'c')}</lastmod>
</sitemap>
</f:for>
</sitemapindex>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="{xslFile}"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<f:for each="{items}" as="item">
<f:if condition="{item.loc}">
<url>
<loc>{item.loc}</loc>
<lastmod>{item.lastMod -> f:format.date(format: 'c')}</lastmod>
<f:if condition="{item.changefreq}">
<changefreq>{item.changefreq}</changefreq>
</f:if>
<f:if condition="{item.priority}">
<priority>{item.priority}</priority>
</f:if>
</url>
</f:if>
</f:for>
</urlset>
+138
View File
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TYPO3 XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
color: #545353;
}
table {
border: none;
border-collapse: collapse;
}
#sitemap tr:nth-child(odd) td {
background-color: #eee !important;
}
#sitemap tbody tr:hover td {
background-color: #ccc;
}
#sitemap tbody tr:hover td, #sitemap tbody tr:hover td a {
color: #000;
}
#content {
margin: 0 auto;
width: 1000px;
}
.expl {
margin: 18px 3px;
line-height: 1.2em;
}
a {
color: #000;
text-decoration: none;
}
a:visited {
color: #777;
}
a:hover {
text-decoration: underline;
}
td {
font-size:11px;
}
th {
text-align:left;
padding-right:30px;
font-size:11px;
}
thead th {
border-bottom: 1px solid #000;
}
</style>
</head>
<body>
<div id="content">
<h1>TYPO3 XML Sitemap</h1>
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &gt; 0">
<p class="expl">
This XML Sitemap Index file contains <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> sitemaps.
</p>
<table id="sitemap" cellpadding="3" width="100%">
<thead>
<tr>
<th>Sitemap</th>
<th>Last modified</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
<xsl:variable name="sitemapURL">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<tr>
<td>
<a href="{$sitemapURL}"><xsl:value-of select="sitemap:loc"/></a>
</td>
<td>
<a href="{$sitemapURL}"><xsl:value-of select="sitemap:lastmod"/></a>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:if>
<xsl:if test="count(sitemap:sitemapindex/sitemap:sitemap) &lt; 1">
<p class="expl">
This XML Sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
</p>
<table id="sitemap" cellpadding="3" width="100%">
<thead>
<tr>
<th width="70%">URL</th>
<th title="Last Modification Time" width="15%">Last Mod.</th>
<th title="Change frequency" width="10%">Change freq.</th>
<th title="Priority" width="5%">Priority</th>
</tr>
</thead>
<tbody>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:for-each select="sitemap:urlset/sitemap:url">
<tr>
<td>
<xsl:variable name="itemURL">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$itemURL}" target="_blank">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))"/>
</td>
<td>
<xsl:value-of select="sitemap:changefreq"/>
</td>
<td>
<xsl:value-of select="sitemap:priority"/>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:if>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#FF8700" d="M0 0h64v64H0z"/><path fill="#FFF" d="M42.8 32.8c-3.6 0-8.1-10.1-8.1-15.1 0-2.3.9-2.7 3.2-2.7 5.5 0 11 .9 11 4-.1 6.2-4 13.8-6.1 13.8zM28.5 18.5c0 5 6.4 20.2 10.7 20.2.5 0 .9-.1 1.4-.2-3.8 6.1-8.4 10.6-11.2 10.6-5.9 0-14.3-17.9-14.3-25.7 0-1.2.3-2.2.7-2.8 2-2.5 8.4-4.4 13.7-5-.6.4-1 1-1 2.9z"/></svg>

After

Width:  |  Height:  |  Size: 384 B

+61
View File
@@ -0,0 +1,61 @@
{
"name": "typo3/cms-seo",
"type": "typo3-cms-framework",
"description": "TYPO3 CMS SEO - SEO features including specific fields for SEO purposes, rendering of HTML meta tags and sitemaps.",
"homepage": "https://typo3.community/",
"funding": [
{
"type": "membership",
"url": "https://typo3.org/membership"
}
],
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "TYPO3 Core Team",
"email": "typo3cms@typo3.org",
"role": "Developer"
}
],
"support": {
"issues": "https://forge.typo3.org/issues/",
"forum": "https://talk.typo3.org/",
"source": "https://github.com/TYPO3/typo3/",
"docs": "https://docs.typo3.org/c/typo3/cms-seo/main/en-us/",
"rss": "https://news.typo3.com/rss/",
"chat": "https://typo3.community/meet/slack/",
"security": "https://typo3.org/security/"
},
"config": {
"sort-packages": true
},
"require": {
"typo3/cms-core": "15.0.*@dev",
"typo3/cms-frontend": "15.0.*@dev",
"typo3/cms-extbase": "15.0.*@dev"
},
"conflict": {
"typo3/cms": "*"
},
"suggest": {
"typo3/cms-dashboard": "TYPO3 users can add widgets that can help to optimise their website for search engines"
},
"extra": {
"branch-alias": {
"dev-main": "15.0.x-dev"
},
"typo3/cms": {
"extension-key": "seo",
"Package": {
"partOfFactoryDefault": true
}
}
},
"autoload": {
"psr-4": {
"TYPO3\\CMS\\Seo\\": "Classes/"
}
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Seo\Canonical\CanonicalGenerator;
use TYPO3\CMS\Seo\MetaTag\MetaTagGenerator;
use TYPO3\CMS\Seo\MetaTag\OpenGraphMetaTagManager;
use TYPO3\CMS\Seo\MetaTag\TwitterCardMetaTagManager;
defined('TYPO3') or die();
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['metatag']
= MetaTagGenerator::class . '->generate';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\CMS\Frontend\Page\PageGenerator']['generateMetaTags']['canonical']
= CanonicalGenerator::class . '->generate';
$metaTagManagerRegistry = GeneralUtility::makeInstance(MetaTagManagerRegistry::class);
$metaTagManagerRegistry->registerManager(
'opengraph',
OpenGraphMetaTagManager::class
);
$metaTagManagerRegistry->registerManager(
'twitter',
TwitterCardMetaTagManager::class
);
unset($metaTagManagerRegistry);
// Add module configuration
ExtensionManagementUtility::addTypoScriptSetup(trim('
config.pageTitleProviders {
seo {
provider = TYPO3\CMS\Seo\PageTitle\SeoTitlePageTitleProvider
before = record
}
}
'));
+4
View File
@@ -0,0 +1,4 @@
CREATE TABLE pages (
# @todo: db analyzer makes this varchar which would be ok, but the default is lost. needs review
sitemap_priority decimal(2,1) DEFAULT '0.5' NOT NULL,
);