jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => Suggestions - Feature Request => Topic started by: Online-Werkstatt on 24.06.2014 19:10:04

Title: Meta Desc to fill in automatically - [Added in 3.2.34!!!]
Post by: Online-Werkstatt on 24.06.2014 19:10:04
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
Title: Re: Meta Desc to fill in automatically
Post by: ColinM on 25.06.2014 00:14:39
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
Title: Re: Meta Desc to fill in automatically
Post by: Nyx on 16.06.2015 09:32:45
+1  ;)
Title: Meta Desc to fill in automatically [Workaround / hack]
Post by: Nyx on 17.06.2015 11:16:04
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.

Title: Re: Meta Desc to fill in automatically
Post by: Nyx on 22.06.2015 10:05:21
@ Arno:
it is possible to put this code in the next jdownloads release?
Title: Re: Meta Desc to fill in automatically
Post by: Arno on 22.06.2015 11:21:00
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)?  ::)
Title: Re: Meta Desc to fill in automatically
Post by: Nyx on 23.06.2015 08:57:06
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 /...
Title: Re: Meta Desc to fill in automatically - [Added in 3.2.34!!!]
Post by: Arno on 23.06.2015 14:50:52
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);
       }