Can't get correct template for ajax call Background: I've inherited a site built in craft that has a page called "updates" with a button to load additional entries through ajax. The updates page is an entry in the "page" structure and when it's template is called it loads entries stored in a channel also called "updates". The template the "pages" structure points to is pages/_entry.html, and this holds the logic for gathering entries stored in the "updates" channel. However, the ajax script calls /updates/q?param=1 which is somehow calling the template updates/index.html. All while the channel is set to call template entries/_entry.html for the individual entries in the channel.  

So I tried to create a blog page that would work the same way. I created an entry in the "pages" structure called blog, then created the template blog/index.html which is the same as updates/index.html. The ajax script calls /blog/q?param=1 but it returns a 404. I even created a channel in the cms called blog wondering if that was the case but it hasn't helped. What does the url need to be to return blog/index.html?

pages/_entry.html

{% extends "_layout" %}
{% block content %}
{% set myJs %}
window.entryType = '{{ entry.type }}';
{% endset %}

{% includeJs myJs %}
{% cache unless craft.config.devMode %}

  {% if entry.type != 'contact' %}
    {% include ['_partials/_page-header-' ~ entry.type, '_partials/_page-header'] %}
  {% endif %}

  {% include ['_partials/_page-content-' ~ entry.type, '_partials/_page-content' ] %}

{% endcache %}
{% endblock %}


updates/index.html

{% if craft.request.isAjax %}
  {% set layout = "_ajax" %}
{% else %}
  {% set layout = "_layout" %}
{% endif %}


{% extends layout %}
{% set title = 'Updates' %}
{% block content %}

{% cache for 3 hours unless craft.config.devMode %}
  {% if craft.request.isAjax %}
    {% include '_partials/_get-updates' %}
  {% else %}
    {% set entry = craft.entries.slug('updates').featuredUpdate %}

    &lt;section class="l-section u-bg--light-gray"&gt;
      &lt;div class="l-container"&gt;
        {% include '_partials/_updates-filter' %}
        {% include '_partials/_grid-cards' %}
        &lt;div class="l-section__cta"&gt;
          &lt;a href="#" class="btn btn--large" id="load-more"&gt;Load More&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/section&gt;
  {% endif %}

{% endcache %}
{% endblock %}
It looks like a custom route has been set up for /updates/q which points to the updates/index.html template.

There are two places this could have been configured:


Dynamic routes set up in the control panel, or
Advanced routing set up in the routes.php file.


Look in both of those places to see if a custom route has been set up for /updates/q. If so, you will need to set up a similar one for /blog/q so that Craft knows which template to render for those requests.

Craft's routing docs are a good place to start to understand how all of this works.