Help center templating cookbook

Return to top

9 Comments

  • Catherine Michalak
    Community Moderator

    Hi,

    Is there anyone who could help me add subsections to my custom HC code?

    I am struggling to get the section with subsections to show if it doesn't have an article in it (ie. the subsections have articles but until there's an article in the section itself, it doesn't show on the category page) and struggling to keep the layout the same on the section with subsections level as it is on the category with sections level.

    TIA!

    Catherine

     

    0
  • Emelie Stjernquist

    Hello @...,

    Just so I get it right, you wish to display an "empty" section?

    I'm not sure that that is possible to do (at least I've not manage to do that), however I have a suggested work-around which is to:

    1. Create an Article on the Section you wish to display (one that is OK to find if found via search function)
    2. Create a custom Section-template where you modify the html, remove the part that displays/list the articles - Guide from Zendesk help
    3. Edit the Section and assign the new template and publish the Section and Article

    I usually elaborate, test back and forth in the templates until I get the result I want. You can also preview it in "Preview mode" before publishing it.

     

    I hope this helps you to get closer to what you wish to accomplish, good luck!

    //Emelie

    0
  • Francois Spinnael

    The Current_local.name trick isn't working. 

    I'm using this list: https://support.zendesk.com/hc/en-us/articles/203761906-Zendesk-language-support-by-product

    And for some reason, the rename of the "language" is working for English (World) that is defined as a "Variant" but all the other ones, aren't working (Estonia, Lithuania, Latvia, Luxembourg,...)

    <button class="dropdown-toggle" aria-haspopup="true">
    {{#is current_locale.name 'English (Luxembourg)'}}
    Test
    {{else}}
    {{current_locale.name}}
    0
  • Augusto Silva
    Zendesk Engineering

    Hey @...

    Try something like this instead (language names can change):

    {{#contains current_locale.url "/en-us"}}
    true
    {{else}}
    false
    {{/contains}}
    0
  • Blake Robertson

    My Activities has `{{requests}}` template variable on it.  The Home Page does not.  Is there a simple way to expose the `{{requests}}` to the home page for signed in users?

    I'd like to show them their 5 most recent requests on the homepage so it's more visible.

    If that cannot be done, could a Custom Page do this?  Essentially I want a landing page from our product for support that has both their requests and then knowledge base shown under it.  One stop landing page from my product.  We use SSO so our users are already authenticated when going there from the app.

    0
  • Greg Katechis
    Zendesk Developer Support Team

    Hi Blake! I thought about this for a bit to see if I could get creative, but there isn't any way that I could envision where this could be accomplished. As you noted, `{{requests}}` don't exist in the home page template and custom pages also do not contain that helper. I wish I had better news and if I think of anything, I'll drop you a line here.

    0
  • Blake Robertson

    Greg Katechis - thanks for giving it some thought.  I suppose this would need to be accomplished with custom javascript to call an api endpoint we'd host that would then use the REST api and return the data back.  Blockers here: 1) simple documentation showing how to add javascript that invokes web requests to a third party server 2) Any tips on how we could authenticate on our server code that the user account is in fact authenticated... like if we had /api/getTickets?user=<emailAddress> we need to verify the user is in fact logged into zendesk somehow so they couldn't exploit the api to get other peoples tickets. 

    0
  • Greg Katechis
    Zendesk Developer Support Team

    1) For this, you could just make an AJAX request from the custom code in your help center to initiate this call to your server/middleware. While it isn't the exact scenario that you're looking to accomplish, this article should give the basic framework that you would need and then you can just swap out your URL/endpoint.

    2) This one is giving me all sorts of problems...both from a basic implementation standpoint, but especially from a security standpoint. We don't have any method of using OAuth in Guide, which would be the easiest way to accomplish this. You could also use the signed_in helper to confirm that someone is signed in and then grab the CSRF token to do...something clever? Like I mentioned, I don't feel comfortable with this, but maybe the idea would spark something in someone else to a function solution!

    0
  • Blake Robertson

    Thanks Greg. Appreciate the link and the quick response. Maybe I can get a value that is set by the login to uniquely identify the session or something. I’ll hack around. I could provide a token in the return_to portion of the jwt flow. Then modify every page template to store that token in a cookie. And pass that along with server Ajax calls and of course have that same token stored in the user db for checking against. Or maybe just the primary entry point page and have it only work if they redirected there. I’ll sleep on it.

    0

Please sign in to leave a comment.

Powered by Zendesk