vaga / hugo-theme-m10c

A minimalistic (m10c) blog theme for Hugo
https://themes.gohugo.io/hugo-theme-m10c/
MIT License
471 stars 294 forks source link

add support for _index.md #119

Closed pbexiga closed 1 month ago

pbexiga commented 7 months ago

It would be useful to be able to use the content in _index.md if needed. This way you can customize the home page.

pbexiga commented 7 months ago

All we need to do is add the following to layouts_default\list.html

     <div class="post-content">
       {{ .Content }}
     </div>

the complete file should look like this:

{{ define "main" }}
  <article>
    <h1>{{ .Title }}</h1>

    <div class="post-content">
      {{ .Content }}
    </div>

    <ul class="posts-list">
      {{ range where .Paginator.Pages "Type" "!=" "page" }}
        <li class="posts-list-item">
          <a class="posts-list-item-title" href="{{ .Permalink }}">{{ .Title }}</a>
          <span class="posts-list-item-description">
            {{ partial "icon.html" (dict "ctx" $ "name" "calendar") }}
            {{ .PublishDate.Format "Jan 2, 2006" }}
            <span class="posts-list-item-separator">-</span>
            {{ partial "icon.html" (dict "ctx" $ "name" "clock") }}
            {{ .ReadingTime }} min read
          </span>
        </li>
      {{ end }}
    </ul>
    {{ partial "pagination.html" $ }}
  </article>
{{ end }}
vaga commented 1 month ago

The issue has been resolved. See 8295ee808a8166a7302b781895f018d9cba20157