When developing an online store on the opencart engine, you sometimes need to add meta tags for standard store pages, such as for example : contact page, stock page, site map, manufacturers ...
By default, the meta description and keywords are not displayed in opencart on these pages, and in order to fix it we need to correct just two files.
You can certainly buy a module for opencart which adds the ability to edit these pages from the admin panel, but I think this is superfluous, because you just need to add two lines to the page controllers files and to the language files.
The common thing is how to add Meta Description and Meta Keywords for some pages in opencart:
Let's add meta tags to the example of the contacts page, for all other pages we add everything by analogy.
1. Open the controllerΒ /catalog/controller/information/contact.php
And after:
1 |
$this->document->setTitle($this->language->get('heading_title')); |
Add two lines:
1 2 |
$this->document->setDescription($this->language->get('description')); $this->document->setKeywords($this->language->get('keywords')); |
All the controller can be closed. Then open the language fileΒ /catalog/language/russian/information/contact.php
And after the line:
1 |
$_['heading_title']Β = 'Connect with us'; |
Add:
1 2 3 4 |
// Meta tags start $_['description'] = 'Your contact page description'; $_['keywords'] = 'Add a list of keywords separated by commas'; // Meta tags stop |
That's basically all, now on the contacts page if you look at the source code will appear meta tags.
Good luck, try it.
No Comment
You can post first response comment.