Post by nofingershaha » Wed Mar 11, 2015 12:19 am

How do you add the site name to the title for every page? Or at least categories and products?

Newbie

Posts

Joined
Wed Aug 27, 2014 11:49 am

Post by chulcha » Wed Mar 11, 2015 12:44 am

<title><?php echo $title; ?></title>


<title><?php echo $title; ?> - <?php echo $this->congig->get('config_name')</title>

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by labeshops » Wed Mar 11, 2015 2:09 am

That should be config, not congig :)

Note though that unless your site is a well known brand, it's not a big benefit to do this in terms of seo. You would be better off using a short keyword phrase instead of your site name.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by chulcha » Wed Mar 11, 2015 2:30 am

labeshops wrote:That should be config, not congig :)
sorry.
Note though that unless your site is a well known brand, it's not a big benefit to do this in terms of seo. You would be better off using a short keyword phrase instead of your site name.
Yes. Then you might need SEO module.

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by nofingershaha » Wed Mar 11, 2015 4:37 am

Thank you for the quick replies, but im getting this error now on my site.

Parse error: syntax error, unexpected '/' in /home6/animeth1/public_html/catalog/view/theme/default/template/common/header.tpl on line 5

Did i do something wrong?

Newbie

Posts

Joined
Wed Aug 27, 2014 11:49 am

Post by chulcha » Wed Mar 11, 2015 5:40 am

Sorry, written on the knee

This is correct code
<title><?php echo $title; ?> - <?php echo $this->config->get('config_name') ?></title>

Active Member

Posts

Joined
Fri Jul 18, 2014 4:39 pm

Post by nofingershaha » Wed Mar 11, 2015 7:29 am

Thank you that worked great!

Newbie

Posts

Joined
Wed Aug 27, 2014 11:49 am

Post by sinners » Thu Jul 05, 2018 5:08 am

Hi, i'v tried a few ways on my Version 1.5.6.4 , nothing works to get my domain name in the title on every page, only home page, all other pages comes up as the Product Name, wanted to get domain name after each cat and item, any help would be most appreciated. Thanks.

Newbie

Posts

Joined
Thu Jul 05, 2018 4:59 am

Post by sinners » Fri Jul 06, 2018 2:08 am

sinners wrote:
Thu Jul 05, 2018 5:08 am
Hi, i'v tried a few ways on my Version 1.5.6.4 , nothing works to get my domain name in the title on every page, only home page, all other pages comes up as the Product Name, wanted to get domain name after each cat and item, any help would be most appreciated. Thanks.
solved, $this->document->setTitle('your web name - ' . $category_info['name']);
This puts the web name first, does anyone know how to have site name after.

Newbie

Posts

Joined
Thu Jul 05, 2018 4:59 am

Post by IP_CAM » Fri Jul 06, 2018 7:07 am

Well, in your theme header.tpl, change the <title><?php echo $title; ?></title> Line
(it might look a little different, depending on the Theme used) to something, like shown here:

Code: Select all

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <title><?php echo $title; ?></title> HIDE, like shown, or REMOVE Line in full -->
<!-- $separator=" | velomech.ch |  ";  CHANGE Site-URL+ Separator Character -->
<!-- Start Code -->

<title><?php 
	$separator=" | velomech.ch |  ";
	$store_name=$this->config->get('config_title');
	if(trim($store_name)!=trim($title))
	echo $title.$separator.$store_name;
	else
	echo $title;
	?></title>

<!-- End of Code -->	
<base href="<?php echo $base; ?>" />
---
based on this Extension:
https://www.opencart.com/index.php?rout ... n_id=22099
---
Just be aware, that any VqMod/OcMod, eventually ever looking for an Anchor/Tag like:
<title><?php echo $title; ?></title> in a theme header.tpl File,
would no longer find it, and so no longer function, without beeing rewritten as well! :o
Good Luck ;)
Ernie
PS: And be aware of Title max-character Value Recommendations. :D
---
Image

Attachments

siteurl_in_page_titles.jpg

siteurl_in_page_titles.jpg (66.59 KiB) Viewed 207 times


For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 32 guests