Title format on startpage vs other pages

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Title format on startpage vs other pages

Post by svasti » Sat Jan 17, 2015 11:06 am

cmb wrote:I don't think that the current behavior is intended, but it seems that is there since early XH versions,
Yes, and I suppose that's the reason why probably nobody used it. The proof is this therad and the corrsponding German thread. The funny thing is that I wanted to add a function which is already there. Lots of taking about it, meaning, i.e., nobody here was aware of this function. Why, because it didn't work as expected.

It may be one of these strange cases, where actually no one is using this function.
cmb wrote:To be honest, I have noticed it before, but without further consideration I regarded it as intended.
Same thing happend to me, I though "strange, pretty useless" and didn't think about it further. I think, there isn't much risk in fixing it now.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Title format on startpage vs other pages

Post by cmb » Sat Jan 17, 2015 4:57 pm

svasti wrote:
cmb wrote:To be honest, I have noticed it before, but without further consideration I regarded it as intended.
Same thing happend to me, I though "strange, pretty useless" and didn't think about it further. I think, there isn't much risk in fixing it now.
As I've just seen, I have even documented the strange behavior: http://www.cmsimple-xh.org/wiki/doku.ph ... timization (last paragraph). :o

Anyhow, this behavior is there since CMSimple_XH 1.0 at least. The oldest related post I could find is http://cmsimpleforum.com/viewtopic.php? ... 1355#p7661, where the behavior was known, apparently.

Even though I find the current behavior nonsensical, after further consideration I wouldn't call it a bug that should be fixed in a minor release. I assume that most users will simply upload the 1.6.5 patch over their existing installation without further reading the release announcement. The effect would be that the titles of pages where meta_tags' description is set would loose the page heading, which is likely to have an unintended effect wrt. SEO.

I would welcome other opinions, though.
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1090
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Title format on startpage vs other pages

Post by manu » Sun Jan 18, 2015 11:10 am

This is a bug indeed, which probably never exposed.
svasti wrote:I had a look at it. Actually we have the meta-tag title first in the meta pagedata tab, with the nice help tooltip:
<p>A good title might improve the search engine ranking.</p>
However, an entry here, lets say "xxx" results in something unexpected in the browser: "xxx – Welcome to CMSimple_XH"
So the $cf['title']['format']="{SITE} &ndash; {PAGE}" will still give out the page headline and only [SITE] is changed.

I'd consider that a bug. If there is an title entry in the pagedata, $cf['title']['format'] should be overwritten.

The solution is simple:
add

Code: Select all

$cf['title']['format']="{SITE}";
after line 55 in plugins/meta_tags/index.php so that the relevant code becomes:

Code: Select all

/*
 * Set the meta tags contents.
 */
if ($pd_current['title']) {
    $cf['site']['title'] = $pd_current['title'];
    $cf['title']['format']="{SITE}";
} 
As the change is so small and it's a bug in my view and there was a request "Add config var $cf['title']['startpage']", I think all this will be solved with this one little line and we could handle it as a bug and incorporate it still into 1.6.5
Why not this fix?

Code: Select all

/*
 * Set the meta tags contents.
 */
if ($pd_current['title']) {
    $cf['title']['format'] = $pd_current['title'];
}
With this we keep all options in page params input. It just needs a bit of text in the tooltip:

Code: Select all

$pd_current['title'] = 'altTitle - {SITE}';
$pd_current['title'] = '{SITE} - altTitle';
$pd_current['title'] = 'altSite - {PAGE}';

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Title format on startpage vs other pages

Post by cmb » Sun Jan 18, 2015 12:20 pm

manu wrote:Why not this fix?

Code: Select all

/*
 * Set the meta tags contents.
 */
if ($pd_current['title']) {
    $cf['title']['format'] = $pd_current['title'];
} 
Interesting idea! However, the template function pagename() (in cmsimple/tplfuncs.php) is supposed to return $cf['site']['title'],(see http://cmsimpleforum.com/viewtopic.php?f=29&t=1715), so we would have to change its implementation. That's not hard to accomplish, but it would introduce a direct dependency to meta_tags in the core, or another global variable. OTOH we could get rid of $cf['site']['title'] completely, this way. I'm not sure, though, if there are customizations which depend on $cf['site']['title'] and its current behavior.
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1090
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Title format on startpage vs other pages

Post by manu » Sun Jan 18, 2015 3:50 pm

Not the best idea, after reconsider..
$cf['site']['title'] is the site name and is initialized by $tx['site']['title'] and may be altered by the page param plugin. Therefore I stick to Svasti's solution too. It's not the cleanest solution, but it probably is the solution for the moment.

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Title format on startpage vs other pages

Post by svasti » Mon Jan 19, 2015 8:33 pm

To summarise:
it's a bug, let's fix it now: 2 (manu, svasti)
later: 1 (cmb)
never:0

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Title format on startpage vs other pages

Post by cmb » Mon Jan 19, 2015 8:39 pm

svasti wrote:To summarise:
it's a bug, let's fix it now: 2 (manu, svasti)
later: 1 (cmb)
never:0
Yes. Can you commit the change?
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Title format on startpage vs other pages

Post by svasti » Mon Jan 19, 2015 10:28 pm

Have not yet installed the recommended Developing Environment, so if I'll do it the @version entry will not be correct :(

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Title format on startpage vs other pages

Post by cmb » Mon Jan 19, 2015 11:59 pm

svasti wrote:Have not yet installed the recommended Developing Environment, so if I'll do it the @version entry will not be correct :(
To correctly update the @version tag, you don't need the full development environment; this is done by the SVN server. Of course, it would be nice to run the checks, but that's no requirement (it's just recommended).

Anyhow, I have committed the change (r1470). :)
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply