0

I use Joomla 4.1.5, and I created my own Joomla Template following the tutorial from joomla.org. My problem is that while other metadata shows correctly on the frontend pages, the <meta name="keywords"> doesn't show, the other metadata is:

<meta charset="utf-8">
    <meta name="author" content="dhany saguntoro">
    <meta name="robots" content="index, follow">
    <meta name="description" content="biaya bekam menurut rasulullah SAW">
    <meta name="generator" content="Joomla! - Open Source Content Management">

I might have overlooked something within my Template Codes, but I don't know the missed things.

I want the <meta name="keywords"> shows in frontend pages, the shown <meta name="keywords"> must be data written in its own article data.

1

1 Answer 1

1

If you have created your own template... The following code is working when posted inside index.php:

use Joomla\CMS\Factory;

$app = Factory::getApplication();    
$document = $app->getDocument();
$name = 'keywords';
$value = 'school';
$document->setMetadata(htmlspecialchars($name, ENT_COMPAT, 'UTF-8'), htmlspecialchars($value, ENT_COMPAT, 'UTF-8'));

Isn't it? And please, update Joomla to the latest 4.2.4

EDIT: There is no option to insert the keywords meta tag within Joomla 4 backend since this tag is considered irrelevant for SEO as explained in the comment under your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.