How to define Metadata information for your Joomla Component

In this Post i explain How to Define Metadata information for your Joomla Component.

Why Use Metadata?

Metadata is information about your web page content.Metadata will not be displayed on the page, but will be machine analyzable.

Multiple Meta elements with different attributes can be used on the same page. Meta elements can be used to specify page description, keywords, author of the document, last modified, and other metadata.The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.

How to define multiple Metadata Elements for your Joomla Components

$document = JFactory::getDocument();

Define Page Title :

$document->setPageTitle('This is Component Page Title');

Define Page Description :

$document->setMetaData('description', 'This content will be added to the description');

Define Page Keywords :

$document->setMetaData('keywords', 'This will be added to the keywords');

Same as Other Meta Elements

$document->setMetaData('robots','noindex,follow');

 

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *