How do you show different content DIVs in different Home Center Categories?

답변함

4 댓글

  • Ifra Saqlain
    댓글 작업 고유 링크

    Hey Noah,

    It's possible with category IDs. You can check the category IDs and add different content divs.

    Example:

    Homepage - I did for category blocks on homepage. I checked the category's IDs and added the content in div.

     <ul class="blocks-list">
    {{#each categories}}
    {{#if ../has_multiple_categories}}
    <li class="blocks-item">
    <a href='{{url}}' class="blocks-item-link">
    <span class="blocks-item-title">{{name}}</span>
    <span class="blocks-item-description">{{excerpt description}}</span>
    </a>
    {{#is id 360007935212}}
    <div>
    section 1 will have CFAs 1, 2 & 3
    </div>
    {{/is}}

    {{#is id 360007935192}}
    <div>
    section 2 will have CFAs 4, 5 & 6
    </div>
    {{/is}}

    </li>
    {{else}}

     

     

    You can pick this code and replace IDs with your Help center's category IDs.

    Result:

    Category block one - FAQ

    Category block two - Announcement

     

     

    If any query let me know :)

    Thank You

    Team

    2
  • Noah
    댓글 작업 고유 링크

    Many thanks for your assistance

    0
  • Ifra Saqlain
    댓글 작업 고유 링크

    :)

    0
  • Noah
    댓글 작업 고유 링크

    Hi,

    I have been able to add category specific content to different categories by checking if the page has the section ID

    But do you know if it's possible to have category specific content within section pages & article pages, for example, could I have the following :

    In section 1 page
    <div>
        <p>Category 1 specific content</p>
    </div>

    In section 2 page
    <div>
        <p>Category 2 specific content</p>
    </div>

     

    In category 1 article page
    <div>
        <p>Category 1 specific content</p>
    </div>

    In category 2 article page
    <div>
        <p>Category 2 specific content</p>
    </div>

    I ask as I have tried swapping the 'section' reference in your code for the section pages to 'section' and 'article' in article template without success.

    0

댓글을 남기려면 로그인하세요.

Zendesk 제공