Use blog index template as category template I have a blog listing page which works correctly. I also have categories that I would like to use the same template rather than creating a whole new template since the design is exactly the same.

However when I set the category template to blog/index the page loads correctly but doesn't limit by categories.

Looking at my simplified template code, I'm not sure how to get it to display only the category being viewed or all if on the blog index page.

My urls are 

/blog/
/blog/p2 (pagination)
/blog/{{ slug }}


I would like the following url's to use the same template code:

/blog/category/{{ category_url }}
/blog/category/{{ category_url }}/p2


My template code:

{% paginate craft.entries.section('blog').limit(6) as pageInfo, pageEntries %}
{% for entry in pageEntries %}
  &lt;article class="col-sm-6 block" data-mh="blog-rows"&gt;

    some code

    &lt;aside&gt;
      more code
    &lt;/aside&gt;

    &lt;a href="{{ entry.url }}" class="btn btn-primary"&gt;Keep Reading&lt;/a&gt;

  &lt;/article&gt;&lt;!--block--&gt;
{% endfor %}


If necessary I can create a category.html template, but then I'd essentially have duplicate code. Is there a way to do what I want to?
Yup, you can totally re-use the same template. When it is a category page, you will have access to a category variable which is a CategoryModel, and you can use that to filter your entries by category.