<p>Discovered what the issues was - it was my actual Category Names - the Class names which I had called, P1, P2, P3, P4 etc, which had a slug of p1, p2 etc.</p>

<p>Craft was picking those up as page numbers - and trying to route for that.</p>

<p>Discovered it when I had created an entry in a Structure with the title P1 which wasn't loading either.</p>

CC BY-SA 4.0
2018-06-19T15:42:35.510Z
2018-06-19T15:42:35.510Z
mmc501
<p>The template path specified in the admin should point to a single file, not a directory.</p>

<p><code>index</code> files are only loaded when the Craft router falls all the way through element URIs and starts to look in your templates folder—in your case, that would be <code>local.domain.com/pupil-of-the-month</code>.</p>

<p>I suspect the confusion lies in that the router <em>does</em> eagerly look inside a directory for <code>index.*</code> templates in some narrow cases (as stated above), but that the pattern is not adopted by Category/Section/Tag settings.</p>

<p>See the official <a href="https://docs.craftcms.com/v3/routing.html" rel="nofollow noreferrer">Routing Docs</a> for more information about the process Craft uses to resolve the template for a request.</p>

CC BY-SA 4.0
2018-06-18T17:37:02.013Z
The template path to the directory works for all my other Category Groups, just not sure what’s going on with this one. I added /index.html to the end but same error message
mmc501
CC BY-SA 4.0
2018-06-18T16:34:04.640Z
2018-06-18T16:34:04.640Z
August Miller
<p>I have created a new Category on a Craft 3 website but it will not load the template specified. Have other categories all working fine and can't get this one working at all.</p>

<p>Category Config below</p>

<p><a href="https://i.sstatic.net/1h9e1.png]" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1h9e1.png]" alt="enter image description here"></a></p>

<p>I expect this to load my template <code>/pupil-of-the-month/index.html</code></p>

<p>As per the below image in my templates folder.</p>

<p><a href="https://i.sstatic.net/cqQCp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cqQCp.png" alt="enter image description here"></a></p>

<p>But when I click on the category url - <code>http://local.domain.com/pupil-of-the-month/class/p1</code></p>

<p>I get a not found error - </p>

<pre><code>Template not found: pupil-of-the-month/class
</code></pre>

<p>Why is this Category not following the template specified in the admin settings?</p>

CC BY-SA 4.0
2018-06-18T16:37:15.957Z
I answered prematurely—I'm not sure how `class` is sneaking in at the end of the template it's looking for. 
August Miller
CC BY-SA 4.0
2018-06-18T17:37:50.173Z
Yep it’s really got me too. I had the exact same set up on a Craft 2 site so not sure what’s going on here.
mmc501
CC BY-SA 4.0
2018-06-18T20:31:02.590Z
Can you double-check the value stored in the database? I want to make sure you're seeing the right value in the CP. The `categorygroups_sites` table has a column named `template`, which should contain this value.
August Miller
CC BY-SA 4.0
2018-06-18T20:36:29.060Z
Yep Database looks good. urlFormat - `pupil-of-the-month/class/{slug}` template - `pupil-of-the-month/index`
mmc501
<templating><craft3><categories>
Category not loading template
# Category not loading template

(Asked by: username_0 on 2018-06-18)

I have created a new Category on a Craft 3 website but it will not load the template specified. Have other categories all working fine and can't get this one working at all.
Category Config below

I expect this to load my template /pupil-of-the-month/index.html
As per the below image in my templates folder.

But when I click on the category url - http://local.domain.com/pupil-of-the-month/class/p1
I get a not found error - 
Template not found: pupil-of-the-month/class

Why is this Category not following the template specified in the admin settings?

**Tags:** templating, craft3, categories
> **Comments:**
> **username_1**: I answered prematurely—I'm not sure how `class` is sneaking in at the end of the template it's looking for.   
> **username_0**: Yep it’s really got me too. I had the exact same set up on a Craft 2 site so not sure what’s going on here.  
> **username_1**: Can you double-check the value stored in the database? I want to make sure you're seeing the right value in the CP. The `categorygroups_sites` table has a column named `template`, which should contain this value.  
> **username_0**: Yep Database looks good. urlFormat - `pupil-of-the-month/class/{slug}` template - `pupil-of-the-month/index`  

---

## 2 answers

### Answer by username_0 on 2018-06-19. Score: 0 | Accepted answer

Discovered what the issues was - it was my actual Category Names - the Class names which I had called, P1, P2, P3, P4 etc, which had a slug of p1, p2 etc.

Craft was picking those up as page numbers - and trying to route for that.

Discovered it when I had created an entry in a Structure with the title P1 which wasn't loading either.


---

### Answer by username_1 on 2018-06-18. Score: 1

The template path specified in the admin should point to a single file, not a directory.

`index` files are only loaded when the Craft router falls all the way through element URIs and starts to look in your templates folder—in your case, that would be `local.domain.com/pupil-of-the-month`.

I suspect the confusion lies in that the router *does* eagerly look inside a directory for `index.*` templates in some narrow cases (as stated above), but that the pattern is not adopted by Category/Section/Tag settings.

See the official [Routing Docs](https://docs.craftcms.com/v3/routing.html) for more information about the process Craft uses to resolve the template for a request.

> **Comments:**
> **username_0**: The template path to the directory works for all my other Category Groups, just not sure what’s going on with this one. I added /index.html to the end but same error message  

---

