How to Range and Paginate by File Name?

I have several files like this →

blog/001-love-story.md
• title: Love Story

blog/002-about-you.md
• title: About You

blog/003-school-out.md
• title: School Out

blog/004-empty-soul.md
• title: Empty Soul

etc

How to range and paginate by file name?
NOT by weight or alphabetical title?

{{ $p := sort (where site.RegularPages "Type" "posts") "File.Path" "asc" }}
{{ range (.Paginate $p).Pages }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}
{{ template "_internal/pagination.html" . }}
5 Likes

Thanks for response. But the result is different.

By the way, this is my current code →

{{ range (.Paginate (.Pages).Reverse).Pages }}
<article class="list">
<a href="{{ .Permalink }}">
<div class="list-title">
<h2>{{ .Title }}</h2>
</div>
<div class="list-content">
<h3>
{{ .Summary }}
</h3>
</div>
</a>
</article>
{{ end }}

I tried to put “File.Path” in various way but it doesn’t works.

I don’t post untested code. Try it:

git clone --single-branch -b hugo-forum-topic-40974 https://github.com/jmooring/hugo-testing hugo-forum-topic-40974
cd hugo-forum-topic-40974
hugo server

Relevant code in layouts/_default/home.html.