How to remove grouping by date in the blog list page?

Hello!

I want a page with a list of blog posts to display the previews of the first n blog posts.

In particular I want to get rid of April 2024 heading in the screenshot below.

In the file layouts/hugo-texify2/_default/list.html I see the following code:

<main id="main" class="archive">
  {{ $pages := where .Data.Pages "Type" "post" }}
  {{ range $pages.GroupByDate "2006-01" }}
  <div class="post-group">

At a first glance it could be responsible for the current layout (grouping by month).

Questions:

  1. Is it correct that this file is actually used when rendering the page de/post/?
  2. Is it correct that I need to copy themes/hugo-texify2/layouts/_default/list.html to layouts/list.html and then modify it (so that grouping by month is removed)?
  3. How exactly can I specify that I simply want to show the previews of the last n posts (without grouping by date?

Thanks in advance

Yes

No. The path must mirror the theme: layouts/_default/list.html

Yes.

Something like:

{{ range where site.RegularPages "Type" "post" | first 7 }}
  <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
  {{ .Summary }}
{{ end }}
1 Like

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