News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Meta Desc to fill in automatically - [Added in 3.2.34!!!]

Started by Online-Werkstatt, 24.06.2014 19:10:04

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Online-Werkstatt

Hi Arno, Hi Colin,

is it possible to fill in the Meta Description automatically with the File Title or File Description if the Meta Description is not filled in ?!?



Best Regards
  •  

ColinM

Hi
That would be an idea for the future when we get to a stable release in next round of upgrades.  I will move this topic to suggestions
Colin
Colin M
  •  

Nyx

  •  

Nyx

Hi,

i make a little Workaround / hack for this:

edit /components/com_jdownloads/views/download/view.html.php

put the code
if (empty($this->item->metadesc))  //Hack description to meta description
{
$metadescription= $this->item->description;
if (strlen($metadescription) >= 150)
{
  $metadescshort = strip_tags(substr($metadescription, 0, strpos($metadescription," ",150)))." ...";  
}
else
{
  $metadescshort = $metadescription;
}
$this->document->setDescription($metadescshort);
}


after ~ line 304
elseif (!$this->item->metadesc && $this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}

//put the code here



What does this code do?

+ It will check if the meta description is empty.
- If not, ... this is taken.
- If yes, the following is executed:

+ It checks if the download description is longer than 150 characters.
- If not, the Download description will taken for the Meta Description.
- If yes, the download description is truncated to 150 characters (SEO default) and "..." added.

  •  

Nyx

@ Arno:
it is possible to put this code in the next jdownloads release?
  •  

Arno

nHu,
seems for me to be a useful hack.
So i will add this code.

But then we have the next question. Should we add also for the single category view this (with category description)?  ::)
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •  

Nyx

#6
Hi,

thanks, that is a good news ;)

For (only me?) I don't need / want a separate category meta description.
I use the global site meta description for the category.

I think a separate meta description for the Download detail view is important for the SEO and for URL social share with facebook / google + / Twitter /...
  •  

Arno

I have this added now:

       // use the Downloads description when the metadesc is still empty
       if (empty($this->item->metadesc))
       {
           $metadescription = strip_tags(trim($this->item->description));
           $metadescription = preg_replace("/[\n\r]/", "", $metadescription);  
           
           if (strlen($metadescription) >= 150)
           {
              $metadescshort = substr($metadescription, 0, strpos($metadescription," ",150))." ...";  
           }
           else
           {
              $metadescshort = $metadescription;
           }
           $this->document->setDescription($metadescshort);
       }
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •