How to create a custom content type

Can you point me to a good tutorial “How to create a custom content type?”

I always fail, if I try to create an additional content type in a theme. While I find my way with other things.

What I want:

I want to have a microblogging content type called “tweet” or so.

I never get it displayed. I tried to follow the docs on this in several themes but never was successful.

All you have to do is:

  • create your content under the correct directory: hugo new tweet/
  • add the templates for the new content type, i.e.: layouts/tweet/single.html for each tweet; layouts/section/tweet.html for a list of tweets

Take inspiration from other hugo websites with source available, e.g.

Thanks for that hint, but this is what I did. I even cloned spf13 and copied the post type to tweet but it does not work.




When I look at examples it is always done in the way you described, but being blockheaded I always fail, when I try it myself.

This is embarrasing because mostly anything else in hugo work for me.

Update: the strange thing is that the content type “page” works without layout/section/page.html and layout/page/single.html

You probably have a default template: hugo falls back to default templates when cannot find a specific template.

It’s hard to guess what might be wrong without looking at your files. I suggest creating a minimal example to show the problem and uploading it to a temporary repository (on github or wherever).

I think I will post the link to a repository if I can’t sort this out.

I managed to make a custom content type with

Very strange I only had to copy the blog related stuff and it works.