Meta title contactus & advanced search

Open to all! Ask other shopowners for help.
Post Reply
BatteryTrader
Contributor
Posts: 153
Joined: Thu Apr 11, 2024 7:18 am
Phoenix Version: 1.1.0.3
Has thanked: 3 times
Been thanked: 17 times

Meta title contactus & advanced search

Post by BatteryTrader »

Have 1.1.03

Now I loathe to ask this, but I cannot find it, want to add meta title tags to the contact us and advanced search pages, at the moment they are picking up just the website name, so creating dups, not the end of the world, but I cannot find where to edit them, I have a very bad feeling its going to be easy, but a gentle nudge would be nice.

Regards

David


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Meta title contactus & advanced search

Post by ecartz »

https://github.com/CE-PhoenixCart/Phoen ... on.php#L65

Code: Select all

      Guarantor::ensure_global('Template')->set_title(TITLE);
That sets the title.

https://github.com/CE-PhoenixCart/Phoen ... hp#L23-L28

Code: Select all

        $GLOBALS['Template']->set_title(
          ((MODULE_HEADER_TAGS_PRODUCT_TITLE_SEO_TITLE_OVERRIDE === 'True') && ( !Text::is_empty($product->get('seo_title')))
            ? $product->get('seo_title')
            : $product->get('name'))
          . MODULE_HEADER_TAGS_PRODUCT_SEO_SEPARATOR
          . $GLOBALS['Template']->get_title());
That adds the product SEO title to the meta title.

You could add something like

Code: Select all

Guarantor::ensure_global('Template')->set_title(CONTACT_US_TITLE . $GLOBALS['Template']->get_title());
by hook. E.g. hook_shop_contact_us_title->listen_injectRedirects

In the language file, you'd need something like

Code: Select all

const CONTACT_US_TITLE = 'Contact Us | ';
or skip the hook and just put something like

Code: Select all

Guarantor::ensure_global('Template')->set_title('Contact Us | ' . $GLOBALS['Template']->get_title());
in the language file. I think that either way should work.
BatteryTrader
Contributor
Posts: 153
Joined: Thu Apr 11, 2024 7:18 am
Phoenix Version: 1.1.0.3
Has thanked: 3 times
Been thanked: 17 times

Re: Meta title contactus & advanced search

Post by BatteryTrader »

Thank you, works fine, easy when you know how.

Regards

David.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Meta title contactus & advanced search

Post by burt »

I have not tried recently, but you should be able to just add (to the contact_us language file)

const META_SEO_TITLE = 'Contact Us';
const META_SEO_DESCRIPTION = 'An easy for to allow you to contact us';

And similar to the advanced_search langue file

const META_SEO_TITLE = 'Search Our Site';
const META_SEO_DESCRIPTION = 'Blah blah blah';
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Meta title contactus & advanced search

Post by ecartz »

I thought there was something more, but I apparently looked right past it.

That would also require includes/modules/header_tags/ht_pages_seo.php to be turned on.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply