Is it possible to identify if a Gather page is being displayed? | Community
Skip to main content

Is it possible to identify if a Gather page is being displayed?

  • January 11, 2024
  • 3 replies
  • 0 views

Dermot11

I'm trying to modify the header.hbs to be different for Gather pages.  Does anybody know if there is some way of identifying that the page being displayed is a Gather page?

3 replies

Brandon12
  • January 13, 2024

Hey @dermot11

Gather, being Zendesk's community forum feature, typically has its own set of classes or identifiers in the page's HTML structure that you can leverage for this purpose.  To determine which page the user is on (depending on which pages you want to differentiate), You may be able to differentiate based on unique classes or idntifiers:

  • Se the browser's developer tools (usually accessible by right-clicking on the page and selecting "Inspect") to look at the page's HTML structure.
  • Identify any unique classes or identifiers that are specific to Gather pages. These could be in the body tag or surrounding divs.

Then, you could use script like this to dynamically update:

document.addEventListener('DOMContentLoaded', function() {
    if (document.body.classList.contains('gather-page-class')) { // Replace 'gather-page-class' with the actual class you found
        // Modify the header as needed, for example:
        document.querySelector('header').classList.add('custom-gather-header');
        // Or any other DOM manipulation for the header
    }
});

Zendesk Premier Partners like 729 Solutions are skilled in working with clients on custom development work inside of the Zendesk Guide & Gather products.  If this doesn't get you where you need to go, I'd be happy to troubleshoot with you further 1:1.

Brandon


Dermot11
  • Author
  • January 15, 2024

Thank you for your detailed reply, Brandon!

I was hoping to avoid diving into Javascript, but I'll take a closer look at this and see if it helps me achieve what I want.

Thanks again!

Dermot


Stephan12
  • January 16, 2024

Brandon is always fast and brilliant! 
Great job!