Error when upgrading Templating API V1 to V2 internal property | Community
Skip to main content

Error when upgrading Templating API V1 to V2 internal property

  • December 13, 2023
  • 3 replies
  • 0 views

We updated the deprecated properties from API V1 to V2 based on the error messages provided when importing the theme into our instance. However, we are trying to replace the {{internal}} property, but cannot find the property replacement in the API documentation below:

https://developer.zendesk.com/api-reference/help_center/help-center-templates/v1/

Looking at the API V2 documentation, there is no list of the {{internal}} property. Does anyone know which property to replace for our API V2 upgrade?

3 replies

Hi John,
 
The internal property still exists but it is a property of the article object.  This is because content permissions are now controlled on the article level rather than the section level.  So to resolve these errors, ensure all references to internal in your theme have an article context.

  • Author
  • December 15, 2023

Thanks that was super helpful! We were able to bring the errors down to just 2. We are looping for each sections object and declaring an if statement in line 16 of the category_page.hbs file and declaring an if statement using the categories object and if statement on line 23 with the articles.internal property. We also changed the property to article.internal and are still getting the following error message:

not possible to access `internal` in `articles.internal`"

Do we need to declare articles in our pages? Looking at the API documentation, the objects we are using are related object so we are assuming we can use this property.https://developer.zendesk.com/api-reference/help_center/help-center-templates/category_page/Attached are the pages in our theme.

<link href="https://fonts.googleapis.com/css?family=Nunito+Sans" rel="stylesheet">

<nav class="sub-nav">
  {{breadcrumbs}}
  {{search}}
</nav>

<h1 class="page-header">{{category.name}}</h1>

<p>{{category.description}}</p>

<div class="section-tree">
  {{#each sections}}
    <section class="section">
      <h3>
        {{#if articles.internal}}
          <span class="visibility-internal" data-title="{{t 'internal'}}">
            <span class="visibility-internal-icon"></span>
          </span>
        {{/if}}
        <a href="{{url}}">{{name}}</a>
      </h3>
      {{#if articles}}
        <ul class="article-list">
          {{#each articles}}
            <li {{#if promoted}} class="article-promoted" {{/if}}>
              {{#if promoted}}
                <span data-title="{{t 'promoted'}}">★</span>
              {{/if}}
              <a href="{{url}}">{{title}}</a>
            </li>
          {{/each}}
          {{#if more_articles}}
            <a href="{{url}}" class="see-all-articles">
              {{t 'show_all_articles' count=article_count}}
            </a>
          {{/if}}
        </ul>
      {{else}}
        <i class="section-empty">
          <a href="{{url}}">{{t 'empty'}}</a>
        </i>
      {{/if}}
    </section>
  {{else}}
    <i class="category-empty">
      <a href="{{category.url}}">{{t 'empty'}}</a>
    </i>
  {{/each}}
</div>


<link href="https://fonts.googleapis.com/css?family=Nunito+Sans" rel="stylesheet">

<section class="knowledge-base">
  {{#if categories}}
    <div class="category-tree">
      {{#each categories}}
        <section class="category">
          {{#if ../has_multiple_categories}}
            <h2><a href="{{url}}">{{name}}</a></h2>
          {{/if}}
          {{#is name 'General'}}
            <section class="section">
              <h3>Quick Links</h3>
              <ul class="article-list">
                <li><a href="/hc/en-us/requests">My Tickets</a></li>
                <li><a href="/hc/en-us/requests/new">Submit New Request</a></li>
              </ul>
            </section>
          {{/is}}
          {{#each sections}}
            <section class="section">
              <h3>
                {{#if articles.internal}}
                  <span class="visibility-internal" data-title="{{t 'internal'}}">
                    <span class="visibility-internal-icon"></span>
                  </span>
                {{/if}}
                <a href="{{url}}">{{name}}</a>
              </h3>
              {{#if articles}}
                <ul class="article-list">
                  {{#each articles}}
                    <li {{#if promoted}} class="article-promoted" {{/if}}>
                      {{#if promoted}}
                        <span data-title="{{t 'promoted'}}">★</span>
                      {{/if}}
                      <a href="{{url}}">{{title}}</a>
                    </li>
                  {{/each}}
                </ul>
                {{#if more_articles}}
                  <a href="{{url}}" class="see-all-articles">
                    {{t 'show_all_articles' count=article_count}}
                  </a>
                {{/if}}
              {{else}}
                <i class="section-empty">
                  <a href="{{url}}">{{t 'empty'}}</a>
                </i>
              {{/if}}
            </section>
          {{else}}
            <i class="category-empty">
              <a href="{{url}}">{{t 'empty'}}</a>
            </i>
          {{/each}}

          {{#if more_sections}}
            <div>
              <a href="{{url}}">{{t 'see_all_sections'}}</a>
            </div>
          {{/if}}
        </section>
      {{/each}}
      {{pagination}}
    </div>
  
  {{/if}}
  
</section>

Hi John,
 
Happy to clarify.  So "articles" is simply the name of the array of article objects.  To access each article's internal property, you'll have to iterate through the array:
 
{{#each articles}}
            {{#if internal}}
            <!-- internal-specific content -->
            {{/if}}
             
 {{/each}}