Adding news section with limited number of posts and without extra pages


I’m using hugo academic ( and I’m pretty happy that it’s very easy to use. I wanted to change its structure and add a “news” section that would show about 10 most recent entries, each shown fully right where it is, i.e., I don’t want it to have a “continue reading” button. I’d also like to avoid having a clickable title. Ideally, it should have an archive section just the way “posts” have it.

Can you help me to create it?

You have two options:

  1. If you have money you can post to #services. I list it first because that’s all there is to it. Now for the more interesting option,
  2. You can learn how to do it yourself, and ask questions when you hit a difficult point.

If you opt for #2, please read all the documentation. Just read it all; you don’t have to understand it. But that will provide scaffolding, and you’ll have a sense of what things are called.

You want to add a section, and modify multiple templates. Good luck! :slight_smile:

1 Like

Thank you for reply! As I was asking for help, my intention was not to pay someone to do it for me.
My first guess was that it is possible to find a solution based on academic per se. Based on your answer, it seems that currently it’s not possible.
But I still think there should be a simple solution. The theme has “Recent posts” section which already implements many features that I need except for that it creates a separate page for every post and add a link to it. Maybe, what should be done is a partial solution which just turns the links off. It looks like posts are defined using the following code (inside layouts/section/post.html)

{{ partial "header.html" . }} {{ partial "navbar.html" . }} {{ partial "page_header.html" . }}
{{ with .Content }}
{{ . }}
{{ end }} {{ $paginator := .Paginate .Data.Pages }} {{ range $paginator.Pages }} {{ $params := dict "post" . }} {{ if eq $.Params.list_format 0 }} {{ partial "post_li_simple" $params }} {{ else if eq $.Params.list_format 1 }} {{ partial "post_li_detailed" $params }} {{ else }} {{ partial "post_li_stream" $params }} {{ end }} {{ end }} {{ partial "pagination" . }}
{{ partial "footer_container.html" . }} {{ partial "footer.html" . }}

To me it looks like here we have a bunch of if-else statements that would potentially import different pieces from “partials”. I also found that in the “header” module, which seems to be imported by “post” in the first line, there are statements that print some kind of urls. For instance,
{{ printf “” (printf $css.academicons.url $css.academicons.version) $css.academicons.sri | safeHTML }}
Do you think I can turn links off by removing a “printf” somewhere?

I misread your title, thought you wanted extra pages.

Okay, so Academic uses a widget system, specific to that theme. You can override it in the template lookup, and remove URLs from the posts widget you are using.

If you follow the advice at Requesting Help and share your project, folks can point out which template you need to edit.

1 Like

Oh, sure, here is the link to my project. It’s just the academic theme with some content for my website

How can I find the place where the urls that I need are? Any idea on what file and/or variable I should be looking for? I’m not sure for example about “printf”, it looks like it just prints a string rather than makes something clickable.

The way that theme works is by loading a widget based on front matter in home. For your current posts section, you have:

# Recent Posts widget.
# This widget displays recent posts from `content/post/`.

date = "2016-04-20T00:00:00"
draft = false

title = "Recent Posts"
subtitle = ""
widget = "posts"

# Order that this section will appear in.
weight = 40

# Filter posts by tag.
#  By default, show all recent posts.
#  Filtering example: `tags_include = ["hugo", "academic"]`
tags_include = []
tags_exclude = []

# Number of posts to list.
count = 5


That loads the widget in theme at, which read the front matter options, and ultimately chooses to render the content with one of three partials:

I’d try changing the partial at :

That seems like the easiest, and you just remove the anchor element. You can override by putting the partial in your site, at layouts/partials/post_li_simple.html. :slight_smile:

1 Like

I removed the “href” block from “post_li_stream” and not it is exactly what I wanted. Thank you very much!