From 37cbf125456870bff49be0eaa0b939f4af07e64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Tue, 1 Oct 2019 12:45:18 +0200 Subject: [PATCH 1/2] Make custom redirects domain based --- .../ep_track/Classes/Hook/ItemsProcFunc.php | 26 +++++++++++++++++++ .../Classes/Middleware/TrackingMiddleware.php | 5 ++++ .../TCA/tx_eptrack_domain_model_redirect.php | 11 +++++++- public/typo3conf/ext/ep_track/ext_tables.sql | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php diff --git a/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php b/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php new file mode 100644 index 00000000..03076c3a --- /dev/null +++ b/public/typo3conf/ext/ep_track/Classes/Hook/ItemsProcFunc.php @@ -0,0 +1,26 @@ +getAllSites() as $site) { + /** @var Site $site */ + $domains[] = [$site->getBase()->getHost(), $site->getBase()->getHost()]; + } + $config['items'] = $domains; + } +} \ No newline at end of file diff --git a/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php b/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php index 9221796b..a2502cfe 100644 --- a/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php +++ b/public/typo3conf/ext/ep_track/Classes/Middleware/TrackingMiddleware.php @@ -76,6 +76,7 @@ class TrackingMiddleware implements MiddlewareInterface { /** @var NormalizedParams $params */ $params = $request->getAttribute('normalizedParams'); + $sourceHost = $params->getHttpHost(); $uri = strtok(strtolower($params->getRequestUri()), '?'); if (substr($uri, -1) !== '/') { @@ -88,6 +89,10 @@ class TrackingMiddleware implements MiddlewareInterface ->select('*') ->from('tx_eptrack_domain_model_redirect') ->where('redirect_from = LOWER(:uri)') + ->andWhere($qb->expr()->orX( + $qb->expr()->eq('source_host', $qb->createNamedParameter('*')), + $qb->expr()->eq('source_host', $qb->createNamedParameter($sourceHost)) + )) ->andWhere('deleted = 0') ->andWhere('hidden = 0') ->setParameter('uri', $uri) diff --git a/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php b/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php index b1925173..61732d16 100644 --- a/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php +++ b/public/typo3conf/ext/ep_track/Configuration/TCA/tx_eptrack_domain_model_redirect.php @@ -28,7 +28,8 @@ return [ ], 'types' => [ '1' => [ - 'showitem' => 'hidden, label, redirect_from, target_page_uid, --palette--;;codes, --palette--;UTM;utm', + 'showitem' => 'hidden, label, source_host, redirect_from, target_page_uid, --palette--;;codes, + --palette--;UTM;utm', ], ], 'palettes' => [ @@ -129,6 +130,14 @@ return [ ], ], + 'source_host' => [ + 'label' => 'Domain', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'itemsProcFunc' => \EP\EpTrack\Hook\ItemsProcFunc::class.'->user_domainItems', + ], + ], 'label' => [ 'exclude' => 0, 'label' => 'LLL:EXT:ep_track/Resources/Private/Language/locallang.xlf:tx_eptrack_domain_model_redirect.label', diff --git a/public/typo3conf/ext/ep_track/ext_tables.sql b/public/typo3conf/ext/ep_track/ext_tables.sql index 35a4a6cb..e47873eb 100644 --- a/public/typo3conf/ext/ep_track/ext_tables.sql +++ b/public/typo3conf/ext/ep_track/ext_tables.sql @@ -8,6 +8,7 @@ CREATE TABLE tx_eptrack_domain_model_redirect ( pid int(11) DEFAULT '0' NOT NULL, label varchar(255) DEFAULT '' NOT NULL, + source_host varchar(255) DEFAULT '' NOT NULL, redirect_from varchar(255) DEFAULT '' NOT NULL, target_page_uid varchar(255) DEFAULT '' NOT NULL, tracking_code varchar(255) DEFAULT '' NOT NULL, From 4dc46f83c5af611e57cfd9f683ec07993ee8e1d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjo=CC=88rn=20Fromme?= Date: Wed, 2 Oct 2019 11:22:06 +0200 Subject: [PATCH 2/2] Include yoast seo --- composer.json | 1 + composer.lock | 83 ++++++++++++++++++++++-- config/sites/ep-reisen/config.yaml | 11 ++-- config/sites/ski-boarderweek/config.yaml | 1 + config/sites/ski-wochenenden/config.yaml | 2 +- config/sites/snowzone/config.yaml | 1 + config/sites/unichamp/config.yaml | 1 + 7 files changed, 87 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index ee2be881..634df32d 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,7 @@ "typo3/cms-tstemplate": "^9.5", "typo3/cms-viewpage": "^9.5", "wazum/pagetree-resizable": "^1.2", + "yoast-seo-for-typo3/yoast_seo": "^5.1", "yohang/calendr": "^2.1" }, "scripts": { diff --git a/composer.lock b/composer.lock index f44b53ee..b837f6b5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "43ff1e099d6b3f1ded82923c05a3e7f8", + "content-hash": "d4ae2398be4121ef52aadf3eb1277575", "packages": [ { "name": "algo26-matthias/idna-convert", @@ -146,16 +146,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb" + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fa4c4e861e809d6a1103bd620cce63ed91aedfeb", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", "shasum": "" }, "require": { @@ -164,7 +164,7 @@ }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5@dev" + "phpunit/phpunit": "^7.5" }, "type": "library", "extra": { @@ -210,7 +210,7 @@ "docblock", "parser" ], - "time": "2019-08-08T18:11:40+00:00" + "time": "2019-10-01T18:55:10+00:00" }, { "name": "doctrine/cache", @@ -5046,6 +5046,75 @@ "description": "Make the backend page tree horizontally resizable", "time": "2018-11-26T06:55:42+00:00" }, + { + "name": "yoast-seo-for-typo3/yoast_seo", + "version": "v5.1.0", + "source": { + "type": "git", + "url": "https://github.com/Yoast/Yoast-SEO-for-TYPO3.git", + "reference": "76b5bc54a215dc7d8957677ca24c9813f6dc787a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/Yoast-SEO-for-TYPO3/zipball/76b5bc54a215dc7d8957677ca24c9813f6dc787a", + "reference": "76b5bc54a215dc7d8957677ca24c9813f6dc787a", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php": "^7.0", + "typo3/cms-core": "^8.7|^9.5" + }, + "replace": { + "typo3-ter/yoast-seo": "self.version", + "yoast_seo": "self.version" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "nimut/testing-framework": "^4.1" + }, + "suggest": { + "typo3/cms-seo": "^9.5" + }, + "type": "typo3-cms-extension", + "extra": { + "typo3/cms": { + "cms-package-dir": "{$vendor-dir}/typo3/cms", + "web-dir": ".Build/Web" + } + }, + "autoload": { + "psr-4": { + "YoastSeoForTypo3\\YoastSeo\\": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-or-later" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Team MaxServ", + "email": "support@maxserv.com", + "homepage": "https://maxserv.com" + } + ], + "description": "Yoast SEO for TYPO3", + "homepage": "https://yoast.com", + "keywords": [ + "MaxServ", + "TYPO3 CMS", + "seo", + "yoast" + ], + "time": "2019-09-20T14:23:25+00:00" + }, { "name": "yohang/calendr", "version": "2.1.2", diff --git a/config/sites/ep-reisen/config.yaml b/config/sites/ep-reisen/config.yaml index 6733199d..0e825788 100644 --- a/config/sites/ep-reisen/config.yaml +++ b/config/sites/ep-reisen/config.yaml @@ -216,8 +216,9 @@ routeEnhancers: default: / index: '' map: - /: 0 - /json: 1701 - /html: 1702 - .json: 1803 - sitemap.xml: 1533906435 + '/': 0 + '/json': 1701 + '/html': 1702 + '.json': 1803 + 'sitemap.xml': 1533906435 + 'yoast-snippetpreview.json': 1480321830 diff --git a/config/sites/ski-boarderweek/config.yaml b/config/sites/ski-boarderweek/config.yaml index 9208af19..fdb9adb7 100644 --- a/config/sites/ski-boarderweek/config.yaml +++ b/config/sites/ski-boarderweek/config.yaml @@ -55,3 +55,4 @@ routeEnhancers: '/json': 1701 '/html': 1702 'sitemap.xml': 1533906435 + 'yoast-snippetpreview.json': 1480321830 diff --git a/config/sites/ski-wochenenden/config.yaml b/config/sites/ski-wochenenden/config.yaml index d4fb11f8..f0ad45d4 100644 --- a/config/sites/ski-wochenenden/config.yaml +++ b/config/sites/ski-wochenenden/config.yaml @@ -52,4 +52,4 @@ routeEnhancers: '/json': 1701 '/html': 1702 'sitemap.xml': 1533906435 - + 'yoast-snippetpreview.json': 1480321830 diff --git a/config/sites/snowzone/config.yaml b/config/sites/snowzone/config.yaml index 44b8bf1b..5ec3d0dd 100644 --- a/config/sites/snowzone/config.yaml +++ b/config/sites/snowzone/config.yaml @@ -55,3 +55,4 @@ routeEnhancers: '/json': 1701 '/html': 1702 'sitemap.xml': 1533906435 + 'yoast-snippetpreview.json': 1480321830 diff --git a/config/sites/unichamp/config.yaml b/config/sites/unichamp/config.yaml index 1ec2262a..cad09326 100644 --- a/config/sites/unichamp/config.yaml +++ b/config/sites/unichamp/config.yaml @@ -55,3 +55,4 @@ routeEnhancers: '/json': 1701 '/html': 1702 'sitemap.xml': 1533906435 + 'yoast-snippetpreview.json': 1480321830