Joomla PHP Expert: Pull Robots Inside Custom Index.php

Job ID: 35172383

Budget: $15 – $25 USD

READ EVERYTHING - AUTOMATIC BOOTS OR REPLIES WILL BE IGNORE

######################
######################
######################

1) EXPLAINING BEFORE SHOWING WHAT I NEED

Joomla Templates have inside the index.php the following code.

<jdoc:include type="head" />

This code pulls many things into the head of the template including the meta robots from the pages, menus, categories, etc.

THIS: https://prnt.sc/VLxCuSnhocHy

WHICH CREATES THIS ON FRONT END: https://prnt.sc/fr21JuOgnvL3

######################
######################
######################

2. WHAT I WANT?

I need someone that can pull this robots code regardless if the (<jdoc:include type="head" />) is present on theme or not.

EXAMPLE:

For instance, right now if (<jdoc:include type="head" />) is present, it creates the code below inside the front end coding.

THIS IS CREATED: <meta name="robots" content="noindex, nofollow" />

But if I take out or delete (<jdoc:include type="head" />)

The code below gets eliminated from the front end coding.

THIS DISAPPEARS: <meta name="robots" content="noindex, nofollow" />)

So I want meta robots become independent from (<jdoc:include type="head" />)

This means you might need to add some PHP code inside the index.php that pulls meta robots without the (<jdoc:include type="head" />)

Eliminate that dependency.

IMPORTANT: You should have your own server or local server to do testings.

Then after you solve this, you will share with me the solution.

If you read all of this and understood task, please add at the beginning of your bid the text below.

TEXT: "Yes I can add meta robots to custom index.php"

Ask me questions if needed

######################
######################
######################

3. CURRENT INDEX.PHP CODE

This is the current index.php

######################
######## CODE #########
######################

<?php

defined( '_JEXEC' ) or die( 'Restricted access' ); //Basic protection for PHP Joomla files
$doc = JFactory::getDocument();
$doc->setHtml5(true); //Change document to HTML5

/* THIS GET ALIAS INSIDE BODY CLASS FOR CUSTOM CSS */
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive();
$pageclass = ''; // Notice how the variable is empty first. Then place the code below.

// ADDED FOR GET IMAGES
$article = JTable::getInstance("content");
$article->load(JRequest::getInt("id"));
$article_images = $article->get("images");
$pictures = json_decode($article_images);
$images = json_decode($this->item->images);
$img=JURI::base() . $pictures->image_intro;

if (is_object($menu))
$pageclass = $menu->params->get('pageclass_sfx');

?>
<!doctype html>
<html lang="<?php echo $this->language; ?>">
<head>
<!-- HEAD GENERATED BEGINS -->
<jdoc:include type="head" />
<!-- HEAD GENERATED ENDS -->

######################
######## CODE #########
######################
Related categories: PHP Joomla CMS MySQL HTML