#95238Metatags Keywords are not indexed by indexed_search
Description
Hi, i had the problem that the indexed_search doesn’t find any meta keywords on the search results.
Then i debugged this part:
https://github.com/TYPO3/typo3/blob/master/typo3/sysext/indexed_search/Classes/Indexer.php#L400-L415
if ($this->conf['index_metatags']) {
$meta = [];
$i = 0;
while ($this->embracingTags($headPart, 'meta', $dummy, $headPart, $meta[$i])) {
$i++;
}
// @todo The code below stops at first unset tag. Is that correct?
for ($i = 0; isset($meta[$i]); $i++) {
// decode HTML entities, meta tag content needs to be encoded later
$meta[$i] = GeneralUtility::get_tag_attributes($meta[$i], true);
if (stripos($meta[$i]['name'], 'keywords') !== false) {
$contentArr['keywords'] .= ',' . $this->addSpacesToKeywordList($meta[$i]['content']);
}
if (stripos($meta[$i]['name'], 'description') !== false) {
$contentArr['description'] .= ',' . $meta[$i]['content'];
}
}
The problem is, that the while only found the hreflang meta tag an then stop working.
Maybe you can change the part like this, with the new MetaTagApi … it worked for me :)
// get keywords and description metatags
if ($this->conf['index_metatags']) {
// Get Keywords
$metaTagManager = GeneralUtility::makeInstance(MetaTagManagerRegistry::class)->getManagerForProperty('keywords');
$keywords = $metaTagManager->getProperty('keywords');
if(!empty($keywords[0]['content'])) $contentArr['keywords'] .= ',' . $this->addSpacesToKeywordList($keywords[0]['content']);
// Get Description
$metaTagManager = GeneralUtility::makeInstance(MetaTagManagerRegistry::class)->getManagerForProperty('description');
$pageDescription = $metaTagManager->getProperty('description');
if(!empty($pageDescription[0]['content'])) $contentArr['description'] .= ',' . $pageDescription[0]['content'];
}Reviews 2
History 810
-
Christian Hackl commented <span data-processor="relativetime" data-value="2021-10-01T05:40:52+00:00" > 10/01/21, 05:40 </span>
-
Christian Hackl commented <span data-processor="relativetime" data-value="2021-10-05T13:02:46+00:00" > 10/05/21, 13:02 </span>
Workaround:
In your own “ext_localconf.php” write:unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-cached']['indexed_search']);create a PSR-15 Middleware and call it AFTER typo3/cms-frontend/tsfe
Then at the Middleware process() method, call something like:public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { // ... $tsfe = $GLOBALS['TSFE']; $TypoScriptFrontendHook = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Hook\TypoScriptFrontendHook::class); $TypoScriptFrontendHook->indexPageContent([], $tsfe); // ... }In this solution the “no_cache” condition is not considered.
If you want consider the “no_cache” write something like:
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $response = $handler->handle($request); $tsfe = $GLOBALS['TSFE']; $TypoScriptFrontendHook = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Hook\TypoScriptFrontendHook::class); if(!$tsfe->no_cache) { $TypoScriptFrontendHook->indexPageContent([], $tsfe); } return $response; }just put something together, maybe someone needs:
https://github.com/Hauer-Heinrich/hh_indexed_search -
B. Kausch commented and changed TYPO3 Version
1011 <span data-processor="relativetime" data-value="2023-01-30T16:30:11+00:00" > 01/30/23, 16:30 </span>This is clearly a bug. Since switching to the Metatag API, the head content looks like this:
<head> <meta charset="utf-8"> <!-- This website is powered by TYPO3 - inspiring people to share! TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL. TYPO3 is copyright 1998-2023 of Kasper Skaarhoj. Extensions are copyright of their respective owners. Information and contribution at https://typo3.org/ --> <!-- ###TITLEdfaab768279a90e4d957fa20450f0d20### --> <!-- ###METAdfaab768279a90e4d957fa20450f0d20### --> <!-- ###CSS_LIBSdfaab768279a90e4d957fa20450f0d20### --> <!-- ###CSS_INCLUDEdfaab768279a90e4d957fa20450f0d20### --> <!-- ###CSS_INLINEdfaab768279a90e4d957fa20450f0d20### --> <!-- ###JS_LIBSdfaab768279a90e4d957fa20450f0d20### --> <!-- ###JS_INCLUDEdfaab768279a90e4d957fa20450f0d20### --> <!-- ###JS_INLINEdfaab768279a90e4d957fa20450f0d20### --> <!-- ###HEADERDATAdfaab768279a90e4d957fa20450f0d20### --> </head>No meta tags to be found…
-
Martin Weymayer commented <span data-processor="relativetime" data-value="2024-12-20T08:03:31+00:00" > 12/20/24, 08:03 </span>
3 years later bug still exists :-( also in TYPO3 12 …
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-12-20T09:31:36+00:00" > 12/20/24, 09:31 </span>
Maybe a weird question, but: since meta tags nowadays are only used for display in search results and not evaluated by search engines, the keywords should always be contained in regular page content.
If that happens then indexed search would also index these keywords (outside the meta scope). So I would actually recommend to drop that metatag indexing feature alltogether, what do you think?
-
Georg Ringer commented <span data-processor="relativetime" data-value="2026-02-06T12:33:48+00:00" > 02/06/26, 12:33 </span>
funny enough my keywords where found, using a translated page, i only needed to add
if (!empty($pageRecord['keywords'])) { $manager = $this->metaTagManagerRegistry->getManagerForProperty('keywords'); $manager->addProperty('keywords', $pageRecord['keywords']); }but I agree with garvin, keywords are not really a thing anymore
-
Georg Ringer changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2026-02-06T12:33:54+00:00" > 02/06/26, 12:33 </span> -
Gerrit Code Review pushed patch set 1 for main to change 96374 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2026-10-05T20:22:53+00:00" > 10/05/26, 20:22 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 96694 <span data-processor="relativetime" data-value="2026-10-14T17:34:31+00:00" > 10/14/26, 17:34 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-14T18:35:15+00:00" > 10/14/26, 18:35 </span>Applied in changeset commit:227b1d6c5bc5272098fdecc8191647112f08b3ba.
I have looked around a bit in the Class Indexer:
the Title comes from “indexedDocTitle” for whatever reason(?) and the rest of the meta tags from the HTML Content. But the HTML Content is not rendered yet – there are still the placeholders in it, something like ““.
e. g. Indexer.php line: 319 – $this->conf[‘content’];
There it is already clear that he can not parse out meta tags…