HUGO

[SOLVED] Wrong template being applied on server but correct one is applied on local

I have a weird issue that I’m trying to debug.

I have a paginated blog section that is applying the right template when I run hugo serve it displays correctly but when it’s built on the live server it looks totally wrong.

Here is my content/blog file structure:

This is my blog section template structure:

This is what it looks like locally which is correct:

This is what it looks like on the server:

I think my problem might be that the section and the taxonomy are both blog.

I’ve tried using type and layout to specify the template but it never yields the desired result.

How can I go about fixing this issue? Thanks guys.

I know this might be kind of hacky but I managed to fix it by adding this to my template:

{{$sections := "initialize"}}
  {{if eq .URL "/blog/"}}
    {{$sections = .Paginate (where site.Pages "Section" "perch-news")}}
  {{else}}
    {{$sections = .Paginator}}
  {{end}}
  {{range $sections.Pages }}