1

I want to create a Joomla Module that has the capability to write its own text based on the GET data within the submitted URL, it sounds feasible, let's say the submitted URL is

yourdomain.com/index.php?yourarea=JAKARTA

then the created text is

JAKARTA is within our service coverage area

Now I want the JAKARTA is within our service coverage area to be visible in the Description metadata in the HTML Header, it is the Joomla website of course. it should look like this

<head>
<meta name="description" content="JAKARTA is within our service coverage area">
</head>

Consider Google SEO, I want this meta description to be rendered as early as possible because I want Google to Catch this and recognize it as valid metadata. Can we do that?

1

1 Answer 1

1

Yes, you can do that with something like:

use Joomla\CMS\Factory;

$keyword = Factory::getApplication()->input->get('yourarea', '', 'string');
$document = Factory::getDocument();

if($keyword)
{
    $document->setDescription($keyword . ' is within our service coverage area');
}

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.