hugo 首页显示文章列表

/layout/index.html
里面加入:

  <section class="section services py-5">
    <div class="container">
  {{ range where .Data.Pages "Section" "post" }}
    <div class="row g-5">
    {{ range first 6 (.Paginate .RegularPages).Pages }}

        <div class="col-12 col-xl-4">
          <div class="4">
          <a class="text-decoration-none h-100" href="{{ .Permalink }}">

              <h5 class="">{{ .Title }}h5>
              <p class="card-text text-black-61">{{ .Summary | plainify }}p>
          a>
          div>
        div>

    {{ end }}
  div>
  {{ end }}   
    div>
  section>

如果加到嵌入的页面,会出错,只能放首页。目前来看。

参考:
Get Hugo to Show Content from Multiple Sections
https://geekthis.net/post/hugo-posts-from-multiple-sections/

你可能感兴趣的:(Go,hugo,golang)