# Suggestions for content type

**URL:** <https://discourse.gohugo.io/t/suggestions-for-content-type/21923>\
**Category:** support\
**Created:** [November 22, 2019, 5:18pm UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923 "2019-11-22T17:18:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![noah-de](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/noah-de/32/10002_2.png) [@noah-de](https://discourse.gohugo.io/u/noah-de)\
**Post date:** [November 22, 2019, 5:18pm UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/1 "2019-11-22T17:18:28Z")

</div>

Greetings!  
I am new to Hugo but have a background in Django, Rails etc. I am trying to build a very simple website that has 3 types of lists:

- People (with various attributes including a photo),
- Sponsors (with a full name, abbreviation and url)
- Publications (with name, authors, date and sometimes a PDF)

Two of these 2 types have associated [resources](https://gohugo.io/content-management/page-resources/).

I am thinking that they could all be driven from data files (since these aren’t ‘pages’, they are just lists. However, I am not sure where the resources would go…

It took me forever to figure out that for each ‘person’ to have an image, I would need to structure my content like this:  
content/people/  
├── Fred  
│ ├── index.md  
│ └── Fred.png  
├── Geno  
│ ├── Geno.jpg  
│ └── index.md  
├── \_index.md  
└── Tim  
└── index.md

But this approach seems like overkill. We don’t need a page for every piece of content…

How could I associate a PDF file with each publication in a list, or an image with a person, without creating a directory structure?

Many thanks for the advice!

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [November 22, 2019, 6:36pm UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/2 "2019-11-22T18:36:23Z")

</div>

One (potentially naive) approach: in `content/people/_index.md` you could add some custom front matter. Then loop through that front matter. Roughly something like:

```auto
params:
  data:
    - name: Fred
      img: img.jpg
    - name: Geno
      img: img.jpg

```

Am curious what other members would suggest.

---

<div class="post-metadata">

**Author:** ![noah-de](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/noah-de/32/10002_2.png) [@noah-de](https://discourse.gohugo.io/u/noah-de)\
**Post date:** [November 22, 2019, 7:48pm UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/3 "2019-11-22T19:48:45Z")

</div>

Thanks for the suggestion!  
With this approach there is only one sub-directory and all the images are right there within it.

I like the simplicity of the approach!

People also have a ‘association’ label [Faculty, Researcher, Alumi…], and the listing would need to be ordered by ‘association’. Do you think that I could extend your approach to meet that use case?

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [November 22, 2019, 8:18pm UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/4 "2019-11-22T20:18:03Z")

</div>

I think so. First add the `association` entry to each map:

```auto
params:
  data:
    - name: Fred
      association: Faculty
      img: img.jpg
    - name: Geno
      association: Alumni
      img: img.jpg

```

Then order by it:

```nohighlight
{{ range (sort .Params.data "association") }}
...

```

See the sort docs for more power: [https://gohugo.io/functions/sort/#readout](https://gohugo.io/functions/sort/#readout)

---

<div class="post-metadata">

**Author:** ![noah-de](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/noah-de/32/10002_2.png) [@noah-de](https://discourse.gohugo.io/u/noah-de)\
**Post date:** [November 23, 2019, 12:35am UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/5 "2019-11-23T00:35:29Z")

</div>

Excellent!  
So grateful for your advice!

I am having some troubles getting the desired results, so I have been scaling it back to see where the error is.

on **layouts/people/list.html** :  
{{ range .Site.Params.authors }}  
- {{ .lastName }}-  
{{ end }}

and in **config.toml**  
[params.authors]  
[params.authors.Derek]  
“firstName” = “Derek”  
“lastName” = “Perkins”  
[params.authors.Joe]  
“firstName” = “Joe”  
“lastName” = “Bergevin”  
[params.authors.Tanner]  
“firstName” = “Tanner”  
“lastName” = “Linsley”

and even though there is the correct number of loops, there is no content displayed (only dashes).

I feel like this could be a great direction to take this simple project, and I am just missing a small _something_.

Thank you for any community advice!

---

<div class="post-metadata">

**Author:** ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)\
**Post date:** [November 23, 2019, 3:08am UTC](https://discourse.gohugo.io/t/suggestions-for-content-type/21923/6 "2019-11-23T03:08:16Z")

</div>

My TOML table nesting isn’t up to par. Personally I would write it in YAML or JSON as I find those easier to understand what’s going on.
