How to remove meta keyword tag from a specific page in joomla 2.5

How to remove meta tags from a specific page in joomla 2.5. I need to eliminate it from one page. However, it will remain on other pages as is. I tried using the jQuery remove () function, but that didn't work.

Here is the script:

<script type="text/javascript">
                jQuery(function(){
                   jQuery("meta[name='keywords']").remove(); 
                });
            </script>
+4
source share
2 answers

Try it,

$document = JFactory::getDocument();
$document->setMetaData('keywords', "");
$document->setMetaData('robots', "");
$document->setMetaData('author', "");

Learn more about the Joomla page metadata set .

Hope this works.

+2
source

You can remove meta tags by setting its contents to an empty string through the JDocument class.

For instance:

$doc =& JFactory::getDocument();
$doc->setMetaData('description', '');

This will remove the tag <meta name="description" ... >.

index.php , setMetaData $this:

$this->setMetaData('description', '');

, Joomla! API ( JDocument, setMetaData): http://doc.joomladev.eu/api25/

0

Source: https://habr.com/ru/post/1543408/


All Articles