If stament to identify the homepage or any other page eg. {{#is home_page }}

Respondida

6 Comentarios

  • Arianne Batiles
    Zendesk Customer Care

    Hi Nicolas,

    The meta tags are added automatically on our backend. Hence, even if it’s possible to add the tag via HTML code, that won’t be seen as the H1 set on our end. (Via: About search engine optimization SEO in Help Center

    We have a document head template (example) that allows you to add meta tags. However, this template is added to all help center pages though, meaning any meta tag added there will be reflected in all pages. A workaround could be using JS to dynamically add meta tags as suggested here. However, please note that this is not tested 100% and we cannot guarantee how it will work for every search engine. 

    0
  • Sean Barry

    It is possible using the following code, which I placed at the top of "document_head.hbs". Change the value of '/hc/en-us' to a different value if yours differs from below:

    {{#is help_center.url '/hc/en-us'}}
        <meta name="description" content="(DESCRIPTION VALUE YOU WANT HERE)">
    {{/is}}

    0
  • Swapnali Padale

    Hi ,

    I want to add class here <main role="main"> only for homepage.

    Can I do this by checking the if it's home page or not? If it is possible then how can we do that?

    I was adding the following code in home.hbs file but not working.

    {{#is help_center.url '/hc/en-us'}}
    <script>
     $("main").addClass("test");
    </script>
    {{/is}}

     

     

     

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Hi Swapnali! The likely reason you're running into this issue is because you're using JQuery and we do not have that enabled by default in Guide anymore. Just take a look at this article to ensure that you have the JQuery library available to you. 

    0
  • Swapnali Padale

    Hi Greg,

    Thanks for reply.

    I added the latest version of JS but the condition to identify home page is not working either. 

    what is the correct code to check it?

    0
  • Greg Katechis
    Zendesk Developer Advocacy

    Sorry for the delay here...in the article that I linked above it will show you how to update JQuery in the help center. We're not looking to upgrade JS, it's just that we used to have JQuery built in, but we removed that a few years back so you'll need to add it now.

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk