-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Updated documentation to replace the old urlToCheck hook with …
…the new ModifyPreviewUrlEvent
- Loading branch information
Showing
5 changed files
with
47 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker-compose -f .ddev/docker-compose.docs.yaml up docs | ||
docker compose -f .ddev/docker-compose.docs.yaml up docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.. include:: /Includes.rst.txt | ||
|
||
|
||
.. _events: | ||
|
||
Event | ||
===== | ||
|
||
Event to change the URL to analyse | ||
--------------------------------- | ||
By default the extension is generating the URL to analyse based on the Site Configuration and configured Route Enhancers. In some cases | ||
you want to change the URL that needs to be analysed. With the `ModifyPreviewUrlEvent`, you will be able to alter the URL that will be | ||
used to analyse your content. | ||
|
||
First you need to create an EventListener that will : | ||
|
||
.. code-block:: php | ||
<?php | ||
namespace Vendor\Package\EventListener; | ||
use YoastSeoForTypo3\YoastSeo\Event\ModifyPreviewUrlEvent; | ||
final class ModifyPreviewUrlEventListener | ||
{ | ||
public function __invoke(ModifyPreviewUrlEvent $event) | ||
{ | ||
$url = $event->getUrl(); | ||
$site = $event->getSite(); | ||
$pageId = $event->getPageId(); | ||
$languageId = $event->getLanguageId(); | ||
// Create a new url based on your needs | ||
$event->setUrl($newUrl); | ||
} | ||
} | ||
After you created your event listener to alter the URL, you need to register it in your `Services.yaml`. | ||
|
||
Check the TYPO3 documentation for your used TYPO3 version on how to register this correctly. | ||
|
||
After you have registered the listener, you need to clear the TYPO3 cache through the `Maintenance` module | ||
(or `vendor/bin/typo3 cache:flush`) before your code will be activated. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters