You are here:  » Title on category and brand pages


Title on category and brand pages

Submitted by IG on Mon, 2018-11-26 21:11 in

Hi David

I am using the following text snippet from the forum to show a title on category pages:

{code saved}

It works perfect on the first page where the title is displayed as "Smartphones example.com".

However, on the second page it shows as "Smartphones | Page 2 Price example.com", which is not ideal.

Ideally, it should display on the second page as "Smartphone example.com | Page 2".

Is it possible to somehow move the "| Page 2" part to the end of the title?

Cheers,
IG

Submitted by support on Tue, 2018-11-27 09:04

Hi,

Sure - in search.php there is a section that appends the sort and page number to avoid duplicate titles; beginning at line 526:

    if ($sort <> "relevance")
    {
      $titleSort = array("relevance" => translate("Relevance"),"rating" => translate("Rating"),"priceAsc" => translate("Price: Low to High"),"priceDesc" => translate("Price: High to Low"));
      $header["title"] .= " | ".translate("By")." ".$titleSort[$sort];
    }
    if ($page > 1)
    {
      $header["title"] .= " | ".translate("Page")." ".$page;
    }

If you move your modification immediately _above_ the above code from where it is now then it should appear as expected...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Tue, 2018-11-27 10:01

Hi David,

It makes sense, but unfortunately posting the saved code above as is breaks the website as the code probably needs some fine tuning. I wish I was a coder!

Cheers, IG

Submitted by support on Tue, 2018-11-27 10:45

No worries!

If you would like to email me your search.php with the title modified and working as it is now I'll re-arrange the code as required for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Tue, 2018-11-27 14:16

Hi David,

Thank you for your kind support.

I found a different solution here in the forum that does not add "| Page 2" to the title.

All good for now.

Kind regards,
IG