Answers.Body: <p>In Craft 3, <code>hasURL()</code> is part of a section's <code>siteSettings()</code> as a section exists in multiple sites and can have URLs in one site but not another.</p>
  
  <p>If you are not using multi-sites, a drop-in replacement for your code would be:</p>
  
  <pre><code>{% for section in craft.sections.getAllSections() %}
    {% for sectionSettings in section.siteSettings %}
        {# We only care about sections that have URLs #}
        {% if sectionSettings.hasUrls %}
          &lt;div class="article mb-8"&gt;
            &lt;h2 class="pt-6 mb-4 border-bottom" id="{{  section.name|kebab }}"&gt;{{ section.name }}&lt;/h2&gt;
            &lt;ul class="ml-4 list-reset"&gt;
              {# Loop through each of its entries #}
              {% for entry in craft.entries.sectionId(section.id).limit(null) %}
                &lt;li class="mb-2 text-sm"&gt;&lt;a href="{{ entry.url }}" class="arrow--before"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
              {% endfor %}
            &lt;/ul&gt;
          &lt;/div&gt;
        {% endif %}
    {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-02T12:28:29.603Z
Answers.LastActivityDate: 2020-01-02T12:28:29.603Z
Answers.UserDisplayName: Oli
Body: <p>I am migrating a site from Craft 2 - Craft 3. In my sitemap template I have the following code;</p>
  
  <pre><code>{% for section in craft.sections.getAllSections() %}
    {# We only care about sections that have URLs #}
    {% if section.hasUrls %}
      &lt;div class="article mb-8"&gt;
        &lt;h2 class="pt-6 mb-4 border-bottom" id="{{  section.name|kebab }}"&gt;{{ section.name }}&lt;/h2&gt;
        &lt;ul class="ml-4 list-reset"&gt;
          {# Loop through each of its entries #}
          {% for entry in craft.entries.sectionId(section.id).limit(null) %}
            &lt;li class="mb-2 text-sm"&gt;&lt;a href="{{ entry.url }}" class="arrow--before"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
        &lt;/ul&gt;
      &lt;/div&gt;
    {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>I am getting the error Calling unknown method: <code>craft\models\Section::hasUrls()</code></p>
  
  <p>I cannot find the equivalent or updated value in the Craft 3 docs. Can anyone advise as to how this should be rewritten or what I should use instead of if <code>section.hasUrls</code> in Craft 3?</p>
  
Tags: <craft3><sections><deprecation>
Title: Calling unknown method: craft\models\Section::hasUrls() - Craft 3 upgrade
ThreadText: # Calling unknown method: craft\models\Section::hasUrls() - Craft 3 upgrade
  
  (Asked by: username_0 on 2019-12-30)
  
  I am migrating a site from Craft 2 - Craft 3. In my sitemap template I have the following code;
  
  ```
  {% for section in craft.sections.getAllSections() %}
    {# We only care about sections that have URLs #}
    {% if section.hasUrls %}
      <div class="article mb-8">
        <h2 class="pt-6 mb-4 border-bottom" id="{{  section.name|kebab }}">{{ section.name }}</h2>
        <ul class="ml-4 list-reset">
          {# Loop through each of its entries #}
          {% for entry in craft.entries.sectionId(section.id).limit(null) %}
            <li class="mb-2 text-sm"><a href="{{ entry.url }}" class="arrow--before">{{ entry.title }}</a></li>
          {% endfor %}
        </ul>
      </div>
    {% endif %}
  {% endfor %}
  
  ```
  
  I am getting the error Calling unknown method: `craft\models\Section::hasUrls()`
  
  I cannot find the equivalent or updated value in the Craft 3 docs. Can anyone advise as to how this should be rewritten or what I should use instead of if `section.hasUrls` in Craft 3?
  
  **Tags:** craft3, sections, deprecation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-02. Score: 2 | Accepted answer
  
  In Craft 3, `hasURL()` is part of a section's `siteSettings()` as a section exists in multiple sites and can have URLs in one site but not another.
  
  If you are not using multi-sites, a drop-in replacement for your code would be:
  
  ```
  {% for section in craft.sections.getAllSections() %}
    {% for sectionSettings in section.siteSettings %}
        {# We only care about sections that have URLs #}
        {% if sectionSettings.hasUrls %}
          <div class="article mb-8">
            <h2 class="pt-6 mb-4 border-bottom" id="{{  section.name|kebab }}">{{ section.name }}</h2>
            <ul class="ml-4 list-reset">
              {# Loop through each of its entries #}
              {% for entry in craft.entries.sectionId(section.id).limit(null) %}
                <li class="mb-2 text-sm"><a href="{{ entry.url }}" class="arrow--before">{{ entry.title }}</a></li>
              {% endfor %}
            </ul>
          </div>
        {% endif %}
    {% endfor %}
  {% endfor %}
  
  ```
  
  
  ---
  
  