Add brand name to Meta title
Permalink
For SEO Their is some elegant way to control Meta title and auto add "brand name" or site name with some seperator (, : . / | - )
Some examples:
%PAGE -%SITE (output: page name - brand name)
%PAGE : %SITE (Women's Shoes, Sneakers & Cleats. Nike.com)
%PAGE | %SITE (Mens Shoes: Sports & Training Footwear| adidas US)
Some examples:
%PAGE -%SITE (output: page name - brand name)
%PAGE : %SITE (Women's Shoes, Sneakers & Cleats. Nike.com)
%PAGE | %SITE (Mens Shoes: Sports & Training Footwear| adidas US)
Thanks. In the future i this feature need to be in the Admin also for editors (%sitename ":" %page name)
I change the code - but the seperator wont change. I add my code + comment next to the change (two at the top of the code, 1 in the end ).
I change the code - but the seperator wont change. I add my code + comment next to the change (two at the top of the code, 1 in the end ).
<?php namespace Concrete\Core\Html\Service; class Seo { private $siteName = ''; private $titleSegments = array(); private $titleSegmentSeparator = ' - '; //1. I change this line to "-" private $titleFormat = '%1$s :: %2$s'; // 2. This value dont have any effect (the code works even when i delete this) private $hasCustomTitle = false; public function setSiteName($name) { $this->siteName = $name; } public function hasCustomTitle() {
Viewing 15 lines of 57 lines. View entire code block.
@siton
I don't recommend modifying core files unless you are experimenting or testing.
I believe the default title_format and title_segment_separator are found in the config:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
I don't recommend modifying core files unless you are experimenting or testing.
I believe the default title_format and title_segment_separator are found in the config:
https://github.com/concrete5/concrete5/blob/develop/web/concrete/con...
I recommend looking at the SEO service.
http://documentation.concrete5.org/api/class-Concrete.Core.Html.Ser...
It looks like addTitleSegment() could work. It could possibly be added using an attribute or by path.