Confused about summary layout

The theme I am working with has a summary.html layout in default.

I don’t actually need a summary, happy with signle.html - I have a page ( defined in its top stuff as on a menu ), going to that slug give me a summary - I don’t understand why, and I don’t understand how to get it to display a single, and I can’t work out from the documentation why either.

Help appreciated.

Can you point me to a repo; I would need to know where this summary.html is located in order to help you override it, but this will give you an idea:

Assuming you have themes/yourtheme/layouts/_default/summary.html with something like the following:

<div class="summary">
{{.Summary}}
</div>

Just create the same file but up a level so that it’s in your project directory and remove the unwanted templating. So, using the above example, you could create a layouts/_default/summary.html and leave it blank or comment out what you don’t want, etc. This is because Hugo has a specific lookup order:

<!--
<div class="summary">
{{.Summary}}
</div>
-->

OK, now I have sorted it but don’t understand so an explanation would be good for me.

I had and index.md in a folder called prices - so when I went to /prices I got the summary

I tried just creating a file prices.md in content and that picks up single

So obviously teh folder makes it want to use summary - but not sure of the logic.

path = themes/hugo-strata-theme
url = https://github.com/digitalcraftsman/hugo-strata-theme.git

You need to give me more info…

Also, I linked to the new documentation above for the template lookup order. However, you should be using _index.md and not index.md for your index pages for content sections. This can be found in the current docs, or if you want to take a look at the upcoming docs, I’ve made a specific section in the list template page too:

https://hugodocs.info/templates/lists/#adding-content-and-front-matter-to-list-pages

Thanks, I think I started this before _index.md …

Unfortunately whilst I understand the basic heirachy, there is nothing I can see in the docs that explains why /content/prices/index.md picks up the summary for a single ( apart from it is a mis use … )

setting /contents/prices.md works ( single )
/content/prices/prices.md works (single ) but the slug is domain/prices/prices ( no good)

using /content/prices/_index.md doesn’t work as it uses list format ( as per your document )

But there is a definite difference I’m testing on 20,6 and the summary is appearing but single is appearing on my other server ( which will be probably hugo 18 ), I assume a difference because of index.md no longer should be used

Try content/prices.md, which should render according to single.html and output to your finished site as /prices/index.html…

Right. Here is the code in question:

As I mentioned above, _index.md has specific use in that it’s the way to add content and front matter to a list page. The docs on what constitutes a list page also might help you:

https://hugodocs.info/templates/lists/#what-is-a-list-page-template

This is the way Hugo’s data model and content organization work. An _index.md content file doesn’t render according to a single.html layout because it’s not a single content page; it is a list page.

I’m also going to phone a friend and ask @digitalcraftsman for some input since he is the guru of this particular theme. Also, summary.html is a content view (hence the use of .Render). HTH.

@rdwatters already gave a good overview of why summary.html is rendered. If something is still unclear feel free to post your question(s).

1 Like

Thanks all for your input and help.