Partials issue with content/_index.md (home page)

Not sure if this is only an issue with the Mainroad theme, but here is the issue:

I am unable to add a partial on the home page created from content/_index.md. I can add it to any other just fine. I can add it to a layout and it works on all pages except the home page.

Any ideas?

Thanks.

There’s not enough information to answer your question.

Changing the content/_index.md to index.md allowed the partial to be added as I needed but now the menu doesn’t work. So it is definately something related to how the content/_index.md file alone is treated.

It also cloud be the primary div, as partials are included in the sidebar.

It looks like you’ve already raised a question with the theme author:
https://github.com/Vimux/Mainroad/issues/361

Okay - here is everything below. The issue seems to be that content/_index.md does not have a section type or something. When I try and specify the layout in the front matter it seems to be ignored. This is only an issues for the content/_index.md - all others work fine.

Here is the widget that is included in the partial:

Here is the partial that references the widget:
{{ partial “widgets/search-mobile.html” . }}

And the layout that includes the partial:

{{ define “main” }}

{{ partial “mobile-search.html” . }}

{{- with .Title }}

{{ . }}

{{- end }}

{{- with .Content }}

{{ . }}

{{- end }}

{{- .Render “summary” }}

{{ partial “authorbox.html” . }}

{{ end }}

I did but I expect them to come back and say this is not a Mainroad theme issue, but a Hugo issue. That was the response I got when I reported a previous issue. That is why my intial post indicated I was not sure if it was a theme ior Hugo issue.

It is not.

Please, when you post code or configs on this forum, use a fenced code block:

```
code here
```

Or use the </> button in the menu.

1 Like

Found the issue: the index.html template is located in \layouts and not layouts\_default\ with the other templates. Once I added th epartial ther it worked fine.

I still wonder why you went with that theme. Anyway…

I have done a lot of work on it but it matched well with the project. I just wanted something that had the framework I needed and responsiveness working and then planned to build everything else out. But yeah - I wish Mainroad had documentation. I have some other templates I am looking at for the long run.

If you are so far familiar with the structure of mainroad, then just fork it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.