帮助顾ide: Use Categories as page links

16 Comments

  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    @Morris Coyle, you can add blocks on the homepage and put the classes and HTML structure from category blocks, see below how I did, pick the below code, and paste it at your homepage.

    In this code, you can write your box title, box description (Optional), add a custom URL in the anchor tag which redirect the box directly wherever you want.

    Screenshot for the same:

    Output:

    If any confusion do let me know :)

    Thanks

    Team

    0
  • Cara Rebernick

    Hi Ifra,

    I tried doing the above, and it all worked except I'd like the custom urls to not be added to the help center url. Is that possible? For example, I want a category button to lead to honelearners.zendesk.com but instead it leads tohttps://help.honehq.com/hc/www.honelearners.zendesk.com. Any thoughts on how I can fix this?

    Thanks!

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    HeyCara Rebernick:)

    Use the code below:

    $(document).ready(function(){

    if ($('.blocks-item > a > span:contains("CATEGORY NAME ONE")')) {
    $(".blocks-item > a").attr("href", "amazon.com");
    }

    else if ($('.blocks-item > a > span:contains("CATEGORY NAME TWO")')) {
    $(".blocks-item > a").attr("href", "google.com");
    }
    });



    Note: RemoveCATEGORY NAMEONEand write yourcategory namefor which you wanna addcustom url.
    Removeamazon.comand write yourURL.

    If any confusion feel free to ask.

    Thanks

    0
  • Agente Sucursal

    Hi Ifra!

    I'm trying to do this but it doesn't work since we have two languages in our help center. How can I implement the page links in this scenario?

    Thank you in advace.

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    HeyRocio Andújar, you can check the href value of your blocks via JS code:

    Blocks are same, but href values are different for different languages.

    For Danish

    $('a[href^="/hc/da/categories/11695152081172-generel"]').attr("href", "google.com");

    $('a[href^="/hc/da/categories/11695154093332-forfremmet"]').attr("href", "amazon.com");


    For English

    $('a[href^="/hc/en-us/categories/360002539551-General"]').attr("href", "https://wordpress.com/");

    $('a[href^="/hc/en-us/categories/4404022102548-promoted"]').attr("href", "//www.ying8.net/in/#georedirect");



    Output:

    Danish -




    English -

    There are more ways but I used this. If any issue let me know :)

    Thanks

    0
  • Mason Bjerke

    HeyIfra Saqlain,

    Where does the following go? Is it in script.js or in the home_page.hbs? I am having the same issue as Cara:

    $(document).ready(function(){

    if ($('.blocks-item > a > span:contains("CATEGORY NAME ONE")')) {
    $(".blocks-item > a").attr("href", "amazon.com");
    }

    else if ($('.blocks-item > a > span:contains("CATEGORY NAME TWO")')) {
    $(".blocks-item > a").attr("href", "google.com");
    }
    });



    Note: RemoveCATEGORY NAMEONEand write yourcategory namefor which you wanna addcustom url.
    Removeamazon.comand write yourURL.
    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    @Mason Bjerke, that snippet will be add to script.js file at the end of all code of that file.

    $(document).ready(function(){

    if ($('.blocks-item > a > span:contains("CATEGORY NAME ONE")')) {
    $(".blocks-item > a").attr("href", "amazon.com");
    }

    else if ($('.blocks-item > a > span:contains("CATEGORY NAME TWO")')) {
    $(".blocks-item > a").attr("href", "google.com");
    }
    });
    1
  • Amanda Barber

    Trying to have our Training Hub category redirect to another website rather than the section in Zendesk, but have been rather unsuccessful. Using the Obscu template and have this in the home_page.hbs file:

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Hi Amanda Barber,

    I tried it and it's working, I add {{isnt}} condition in anchor tag, see the screenshot:





    Code:

    {{#isnt id4404022102548}}-- My category ID, which I want to redirect to external website.



    {{else}}

    -- External URL

    {{/isnt}}
    1
  • Product Support

    That's great,Ifra Saqlain- it worked, but now my icons are not showing on the category blocks. Any ideas?

    0
  • Product Support

    Ifra Saqlain- any ideas for getting the icons to show up as well?

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Hi Product Support,

    显示类别的图标,按照步骤s below:

    i). Add the script code at the bottom of your home_page.hbs file.



    Screenshot:

    ii). Add the given code inside the blocks item code.




    Screenshot:

    iii). Add CSS to style.css file at the bottom.

    /***** CSS Modifications for Category Images *****/
    .categories .blocks-item-link {
    display: flex;
    align-items: center;
    }

    .blocks-item img, .category-page-images, .section-page-images {
    margin-right: 20px;
    width: 32px;
    height: 32px;
    }


    Screenshot:



    iv). Add this code to document_head.hbs file.




    Screenshot:


    Note:These are category's ID, replace this with yours IDs.

    "4404022102548" : "{{asset 'img_1.png'}}",
    "360004039672" : "{{asset 'img_2.png'}}",
    "360003781252" : "{{asset 'img_3.png'}}",
    "360003781212" : "{{asset 'img_4.png'}}",


    Category ID -4404022102548
    Image Name -img_1.png

    Credit:https://community-tutorial.zendesk.com/hc/en-us/articles/115004178674-Adding-Images-in-Copenhagen-theme?_ga=2.257155657.310386109.1685456562-607324386.1685001940#bottom

    If any query feel free to ask :)

    Thanks

    0
  • Product Support

    I'm using a different template that seems to already have images that should appear?

    {{ help_center.name }}

    {{!-- Hero block --}}




    {{ t 'search' }}


    {{#if settings.translations_enable}}{{dc settings.hero_title}}{{else}}{{settings.hero_title}}{{/if}}


    {{#if settings.translations_enable}}{{dc settings.hero_info}}{{else}}{{settings.hero_info}}{{/if}}


    {{search instant=settings.instant_search class='search search-full' placeholder=settings.search_placeholder}}


    {{!-- Categories section --}}
    {{#if categories}}




    {{ t 'categories' }}


    {{#if settings.translations_enable}}{{dc settings.kb_title}}{{else}}{{settings.kb_title}}{{/if}}




    {{pagination}}




    {{/if}}



    {{!-- Promoted article block --}}

    {{#is settings.toggle_promoted_articles "yes"}}
    {{#if promoted_articles}}

    {{t 'promoted_articles'}}




    {{/if}}
    {{/is}}

    {{!-- Recent article block --}}
    {{#is settings.toggle_recently_viewed_article "yes"}}
    {{recent_articles}}
    {{/is}}

    {{!-- Recent activity block --}}
    {{#is settings.toggle_recent_activity "yes"}}


    {{recent_activity}}

    {{/is}}


    {{!-- Get in touch section --}}
    {{#is settings.contacts_blocks "yes"}}




    {{/is}}

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Add this line of code inside blocks-item:




    Screenshot:

    Try this and let me know.

    1
  • Product Support

    Success - thank you so very muchIfra Saqlain!

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member - 2022
    Most Engaged Community Member of The Year - 2021

    Happy to hear that it worked!

    0

Pleasesign into leave a comment.

Powered by Zendesk