Installation
Requirements
- TYPO3 11.5 LTS, 12 LTS, 13 LTS or 14
- PHP 8.1 or higher
- ke_search extension (version 4.0 or higher)
Installation with Composer
The recommended way to install the extension is via Composer:
composer require davidkohr/ke-search-honeypot
Copied!
Installation via Extension Manager
- Go to the Extension Manager in the TYPO3 Backend
- Search for "ke_search_honeypot"
- Click on "Install"
Activation
After installation:
- Clear all TYPO3 caches
- Add the honeypot partial to your ke_search form template
- Configure the RouteEnhancer (see below)
Quick Start
1. Add Partial to Template
Edit your ke_search form template and add:
<f:render partial="honeypot" />
Copied!
Example complete search form:
<f:form name="searchForm" method="get"
pageUid="{searchPage}"
id="kesearch-form">
<f:form.textfield
name="tx_kesearch_pi1[sword]"
value="{searchParams.sword}"
placeholder="Suchbegriff eingeben..." />
<f:render partial="honeypot" />
<f:form.submit value="Suchen" />
</f:form>
Copied!
2. Configure RouteEnhancer
Add to config/:
routeEnhancers:
KeSearch:
type: Plugin
namespace: tx_kesearch_pi1
routePath: '/{sortByField}/{sortByDir}/{resetFilters}/{page}/{sword}/{__hp}'
_arguments:
sortByField: sortByField
sortByDir: sortByDir
resetFilters: resetFilters
page: page
sword: sword
defaults:
__hp: ''
sortByField: ''
sortByDir: ''
resetFilters: ''
page: '0'
sword: ''
Copied!
3. Clear Caches
# Clear all caches
vendor/bin/typo3 cache:flush
# Or in Backend: Admin Tools > Maintenance > Flush TYPO3 and PHP Cache
Copied!
4. Test
- Search for a term on your search page
- Check that the URL contains the empty honeypot parameter:
/search/.../searchterm// - Navigate through result pages - URLs should maintain the
//at the end
Example:
<form action="..." method="post">
<input type="text" name="tx_kesearch_pi1[sword]" />
<input type="hidden" name="tx_kesearch_pi1[page]" value="{page}" />
<f:render partial="honeypot" />
<button type="submit">Search</button>
</form>
Copied!
That's it! The honeypot field is now active.
Verification
To verify the installation is working:
- View the source code of a page with your search form
- Look for an input field named
tx_kesearch_ pi1 [__ hp] - This field should be positioned off-screen (margin-left: -99999px)
The middleware will automatically reject any search request where this field contains a value.