静的サイトジェネレータHugoにおいて、特定のsectionだけをタイトル名称順にソートしてセクション内の記事名一覧を表示したい場合

静的サイトジェネレータHugoにおいて、特定のsectionだけをタイトル名称順にソートしてセクション内の記事名一覧を表示したい場合、section名と同じファイル名でhtmlファイルを作り、\layouts_defaultという名称のディレクトリに配置します。 例えば、section名がawakeningであれば、awakening.htmlを作り、\layouts_defaultという名称のディレクトリに配置します。 awakening.htmlから呼び出されているhtmlファイルがあれば、それも\layouts_defaultという名称のディレクトリに配置します。 section内の記事 section.html

awakening.htmlの内容の一例|\layouts_defaultに置く|タイトル名称順に昇順ソート

{{ partial "header.html" . }}

<div class="header">
  <h1><a href="/" rel="nofollow">{{ .Title }}</a></h1>
</div>

<div class="content">
  <ul>
  {{ range .Pages.ByTitle }}    <!-- ここが違う -->
    {{ .Render "lili" }}
  {{ end }}
  </ul>
</div>

{{ partial "footer.html" . }}

section.htmlの内容の一例|\layouts_defaultに置く|更新日付順に降順ソート

{{ partial "header.html" . }}

<div class="header">
  <h1><a href="/" rel="nofollow">{{ .Title }}</a></h1>
</div>

<div class="content">
  <ul>
  {{ range .Pages.ByLastmod.Reverse }}    <!-- ここが違う -->
    {{ .Render "lili" }}
  {{ end }}
  </ul>
</div>

{{ partial "footer.html" . }}

{{ .Render “lili” }}として指定されているlili.htmlの内容の一例|\layouts_defaultに置く

<!-- オリジナル -->
<li><lastmod>{{ with .Site.Params.lastmodFormat }}{{ $.Lastmod.Format . }}{{ else }}{{ .Lastmod.Format "2006-01-02 15:04" }}{{ end }}</lastmod> - <a href="{{ .Permalink }}">{{ .Title }}</a></li>