Author Topic: Meta Description  (Read 3895 times)

Offline zouaier

  • Full Member
  • *****
  • Posts: 34
  • Karma: +0/-0
Meta Description
« on: July 11, 2012, 03:06:30 AM »
phpEnter Web Hosting
hello
is it possible to do a "Meta Description & Meta keywords" for each category and subcategory?
thx
« Last Edit: January 01, 1970, 03:00:00 AM by Guest »

Offline Jeremy

  • Full Member
  • *****
  • Posts: 240
  • Karma: +1/-0
Re: Meta Description
« Reply #1 on: July 17, 2012, 03:04:55 PM »
1. First go to Admin > Manage Categories > Edit Category, In textarea Custom Code, enter meta description....


2. themes/THEME/categories.php
Replace this code:
Code: [Select]
<meta name="keywords" content="{$keywords}" />
<meta name="description" content="{$metadesc}" />
<link href="themes/{$themes}/styles/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="themes/{$themes}/styles/categories.css" />
<link rel="alternate" type="application/atom+xml" title="{$sitetitle} - RSS" href="{$sitepath}/rss.php" />
<title>{$sitetitle} {if isset($smarty.get.next)}[{$smarty.get.next}]{else}{/if}</title>

with this code:

Code: [Select]
<link href="themes/{$themes}/styles/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="themes/{$themes}/styles/categories.css" />
<link rel="alternate" type="application/atom+xml" title="{$sitetitle} - RSS" href="{$sitepath}/rss.php" />
<meta name="keywords" content="{$keywords}" />
{foreach from=$categori item=metalink}
{if $metalink.catid eq $smarty.get.id}
{if $metalink.cuscat eq true}<meta name="description" content="{$metalink.cuscat}" />{else}<meta name="description" content="{$metadesc}" />{/if}
<title>{$metalink.name|stripslashes} - {$sitetitle} {if isset($smarty.get.next)}[{$smarty.get.next}]{else}{/if}</title>
{/if}
{/foreach}
« Last Edit: January 01, 1970, 03:00:00 AM by Guest »

Offline Michael

  • Full Member
  • *****
  • Posts: 115
  • Karma: +0/-0
Re: Meta Description
« Reply #2 on: July 17, 2012, 06:17:51 PM »
@Jeremy this solution will not work for subcategories.
 :arrow:

Code: [Select]
<link href="themes/{$themes}/styles/images/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="themes/{$themes}/styles/categories.css" />
<link rel="alternate" type="application/atom+xml" title="{$sitetitle} - RSS" href="{$sitepath}/rss.php" />
<meta name="keywords" content="{$keywords}" />
{assign var="cname" value=$smarty.get.id}
{if isset($categori)}
{foreach from=$categori item=inclink}
{if $inclink.catid eq $cname}
{if $inclink.cuscat eq true}<meta name="description" content="{$inclink.cuscat}" />{else}<meta name="description" content="{$metadesc}" />{/if}
<title>{$inclink.name|stripslashes} - {$sitetitle} {if isset($smarty.get.next)}[{$smarty.get.next}]{else}{/if}</title>
{/if}
{/foreach}
{/if}
{if isset($subcat)}
{foreach from=$subcat item=clink}
{if $clink.catid eq $cname}
{if $clink.cuscat eq true}<meta name="description" content="{$clink.cuscat}" />{else}<meta name="description" content="{$metadesc}" />{/if}
<title>{$clink.name|stripslashes} - {$sitetitle} {if isset($smarty.get.next)}[{$smarty.get.next}]{else}{/if}</title>
{/if}
{/foreach}
{/if}
« Last Edit: January 01, 1970, 03:00:00 AM by Guest »