Data failing to display Please help

└── members
    └── list.toml
├── index.html
├── listing.html
└── member
    ├── list.html

└── partials
    ├── members-list.html
    ├── navigation
    │   └── navigation.html
    ├── pagination.html
    ├── submenu.html
├── member
│   ├──
│   ├── list.html
│   └──


{{ range $.Site.Data.members }}
    {{ partial "members-list.html" . }} 
{{ end }}


listofmembers = [


	{{ range .listofmembers }}
	  <li> {{ . }}</li>
	{{ end }}

Navigating to locahost/members/list gives the following in plaintext:

{{ partial “members-list.html” . }} {{ end }}

What am I doing wrong here?

You can’t use template functions (like range) in content.

I’ve just moved in from jekyll, I’ve spent a long time reading through the documentation but, I still havent got my head around it all evidently.

How should I be arranging this if not via content?

I’ve moved the content into layouts/member

I’ve also removed the header fluff from the file

And it doesn’t work?

after removing the +++ header fluff I’ve got it showing:

{{ partial "members-list.html" . }} {{ end }}

in plaing text, which suggests it is at least… processing something.

Look into your gitter PM


@Nick_Hoskins I am sure that @bogem already solved this for you in your Gitter PM, but in the event that this thread is found by other users, I wanted to add to the thread here to see if the following solves your use case. I think the problem is that your templating and project structure above confuses range, partial, and also content views, the last of which take advantage of the .Render function. Instead, this can be greatly simplified if the idea is that you want to use that same data file in a partial in multiple locations…

{{ range $.Site.Data.members.list.listofmembers }}
{{ end }}

Then in whichever templating file you want to use, just add the following to call the partial…

{{partial "members-list.html" . }}

And your data will write to the page.

That said, you mention your project directory is set up such that you have layouts/member/list.html. This is going to be used as the list page (i.e., the index page) for your member section, which means you will need a corresponding content section for that page (i.e., content/member), so I’m a bit confused.

Note: The dot (.) in Go templates has special meaning when added to that partial. It’s a little more advanced and something you might want to play with, but if you want to make that partial even more usable for multiple types of data files, keep in mind that you can pass other values into the context. Here is a good example from the current Hugo website:

You can also sort, filter, and limit your data. For example, from the Hugo docs concept site:


I still don’t get it. What’s the purpose of a partial if I can’t reuse it?
If i pass the context to a partial, why I can’t access a var in that context?

If I have something like this:

{{ range $service := }} {{ partial "_service.html" . }} {{ end }}

how can i access the $service var inside the partial?

Do one of these:

{{ range }} {{ partial "_service.html" . }} {{ end }}
{{ range $service := }} {{ partial "_service.html" $service }} {{ end }}

The second one worked, thanks.