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)?>" >

Change 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)?>"/>


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded