wazum/seo-canonical-guard

Prevent unwanted parameters in canonical URL

1.1.0 2020-12-18 11:47 UTC

This package is auto-updated.

Last update: 2021-03-19 09:33:21 UTC


README

What does it do?

The TYPO3 core seo extension adds every given parameter from the request to the generated canonical URL.

This extension helps to prevent unwanted parameters in the canonical URL.

Extension plugin namespaces

By default parameters within the namespaces from active extensions (e.g. tx_news_pi1) using Extbase are allowed. This still allows parameters not used by these extensions like tx_news_pi1[wtf]=seo. If you need to include third-party parameters or parameters for extensions based on \TYPO3\CMS\Frontend\Plugin\AbstractPlugin (aka pi based) or need to be very strict, disable the setting and/or use the explicit whitelist.

Explicit whitelist

In addition to or as replacement for the allowed namespaces from active extension Extbase plugins (see above), you can set a whitelist if you need to allow additional parameters or want to specify exactly which parameters are allowed. Go to Admin Tools > Settings > Extension Configuration and select seo_canonical_guard and set the allowed parameters or parameter namespaces as follows:

parameter1, parameter2, namespace_xy\[(.*?)\], namespace_yz\[(explicit1|explicit2)\]

You can add a list of single parameters or use regular expressions (you can omit the /…/ around, but you have to escape special characters).

Requirements

The extension depends on the TYPO3 core seo extension.

Installation

Require the latest package:

composer require wazum/seo-canonical-guard

Inspiration

The extension is inspired by https://github.com/sourcebroker/urlguard which definitely should be installed too if you use the addQueryString when creating links with TypoScript!

Say thanks! and support me

You like this extension? Get something for me (surprise! surprise!) from my wishlist on Amazon or help me pay the next pizza or Pho soup (mjam). Thanks a lot!