calintat / minimal

Personal blog theme powered by Hugo
https://themes.gohugo.io/minimal/
MIT License
404 stars 222 forks source link

Feature request: Optional change on landing page #27

Closed rsangole closed 6 years ago

rsangole commented 7 years ago

Calin,

For the landing page, could we optionally add code that would give us something like:

Title Subtitle (Posts in the past 7 days: x)

x can be a link to take us to posts or projects. The intent of this is to allow new visitors to quickly see if there's something new published recently...

Rahul

jamestharpe commented 6 years ago

You can copy index.html to your site's /layouts directory and change it there.

rsangole commented 6 years ago

Thanks, let me try that out. Any idea how I can get a count of the new posts in the past 7 days?

jamestharpe commented 6 years ago

You can list pages by date:

{{ range .Data.Pages.ByDate }}

And use where to filter the pages.

I can try to come up with a more complete example, but it might not be until next weekend that I have a chance to put it together.

joshlawrence commented 6 years ago

I'm having trouble with this as well, here's what I've done so far:

I copied index.html to my site's layouts directory. I took the contents of the theme's list.html and put it in the index:

{{ partial "header" . }}
<main>
  <h2>{{ .Title }}</h2>
  {{ range (.Paginator 5).Pages }} {{ partial "list-item" . }} {{ end }}
</main>
{{ partial "paginator" . }}
{{ partial "footer" . }}

This works well - I get a list of posts. But it also grabs my pages (for example, about.md) and puts those in the list. How do I avoid that? I'm trying to get my index.html to behave exactly like the theme's Posts page...I'm close, but I'm missing something.

Wonderful work on this theme, I really do love it and it's very easy to work with...Thank you for working on it and making it available!

rsangole commented 6 years ago

I tried to solve this myself, but I couldn't do it. (I'm no css guru!). I don't want to keep this issue open... if it's too tough, we can close it...