How to use custom meta description for every page in Open Classifieds / Osclass, the free classifieds script

osclass ( formarly known as openclassifieds ) is a php script that allows you to quickly create and manage your own free classifieds site. osclass is an open source project that allows you to easily create a classifieds site without any technical knowledge.

We have been using openclassifieds for many years now, and on thing we always wanted to have is use custom meta description for every page generated by every new ad published on our website. Having unique “meta description” for every page helps a lot with SEO, search engine optimisation.

To Achieve this, we changed, themes/default/views/header_metas.php from

[php] <meta name="description" content="<?=HTML::chars($meta_description)?>" > [/php]


[php] <?if (Model_Ad::current()!==NULL AND Model_Ad::current()->loaded()):?> <meta name="description" content="<?=Model_Ad::current()->description?>"/> <?else:?> <meta name="description" content="<?=HTML::chars($meta_description)?>" > <?endif?> [/php]

If we want to restrict meta description length to recent google standard upto 160 charachters, change the code as below,

[php] <meta name="description" content="<?=Text::limit_chars(Model_Ad::current()->description, 155, NULL, TRUE)?>"/> [/php]

Leave a Comment