Help Desk

Title Separator in Browser Tabs Not Working Correctly in Events Pages

  • Posts: 2 Topics: 1
    | Permalink

    Hello there-

    I’ve seen mention of this in various forum posts, and it looks as though the issue often comes down to SEO plugin conflicts. However, our site is not running any SEO plugin and is nevertheless encountering the following problem:

    Our site uses a single pipe (|) to separate the page name from the name of the site. We implemented this global change with a few simple lines in our functions.php file, basically swapping out the :: separator for the |.

    When we add a new event, no title separator or space appears between the event’s title and the site’s name in the browser tab for that event’s page. Instead, it looks like this: New EventWebsite Name.

    In addition, the upcoming events and past events pages are using a dash (-) as the title separator. For example, Upcoming Events-Website Name.

    For the sake of troubleshooting, we removed the functions.php code snippet we had used to modify our title separator. However, there was no change in TEC’s behavior with respect to the title separators in browser tabs.

    This suggests to us that the choice of title separator is being made somewhere in the TEC code. Is there a way for us to make it conform to our site’s current standard? To be clear, we’re not trying to change the system-generated titles themselves, We’re just trying to standardize the way titles are treated in the browser tabs.

    Thanks in advance for your help!

    Posts: 5468 Topics: 13
    | Permalink

    Hi Karl!

    Thanks for reaching out to us! Let me help you with this topic.

    I think you can achieve what you are looking for by using the ‘tribe_events_title_tag‘ filter we provide. As a reference, you can find the filter in here > https://github.com/moderntribe/the-events-calendar/blob/master/src/Tribe/Template_Factory.php#L351

    We also have a good article that shows how you can customize the browser title by using that same filter > https://theeventscalendar.com/knowledgebase/changing-the-browser-title-for-calendar-views/

    I hope that helps. Let me know how that works for you.

    Best,
    Victor

    Posts: 2 Topics: 1
    | Permalink
    This reply has been marked as private.
    Posts: 5468 Topics: 13
    | Permalink
    This reply has been marked as private.
    Posts: 5468 Topics: 13
    | Permalink

    Hi Karl!

    Thanks for your patience while I tested this out.

    After a closer inspection in the code, I found that you can use the document_title_separator filter to change the default “-” separator across the site.

    Try pasting the following snippet into your theme’s functions.php file and see if it works:

    add_filter( 'document_title_separator', function() { return '|'; } );

    Let me know about it.

    Thanks,
    Victor

    Posts: 2 Topics: 1
    | Permalink

    Hi Victor-

    Thank you for your help with this–very much appreciated!

    Everything’s working exactly as expected now.

    Best,
    Karl

    Posts: 5468 Topics: 13
    | Permalink

    Hey Karl! Glad to know that worked out for you! 🙂

    Thanks for following up to let us know about it.

    I’ll close this now, but feel free to open a new topic if anything comes up and we’ll be happy to help.

    Cheers,
    Victor

    | Permalink

The topic ‘Title Separator in Browser Tabs Not Working Correctly in Events Pages’ is closed to new replies.