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
<meta name="description" content="<?=HTML::chars($meta_description)?>" >
To,
<?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?>

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

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

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question