Bày biện single post, thấy khoảng trống còn nhiều, nhét thêm thông tin vào cho đỡ trống

config.toml

Thêm đoạn này vào, sửa indicies1 nếu cần

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# config cho hugo lấy các bài liên quan (single post)
[related]
threshold = 80.0
includeNewer = true
toLower = false

  [[related.indices]]
  name = "categories"
  weight = 100.0

  [[related.indices]]
  name = "tags"
  weight = 100.0

  [[related.indices]]
  name = "date"
  weight = 10.0

partials/post-related.html

1
2
3
4
5
6
7
8
9
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h3>See Also</h3>
<ul>
    {{ range . }}
    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
    {{ end }}
</ul>
{{ end }}

include in single.html

1
{{ partial "post-related.html" . }}

update: my post-related.html as this moment

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{{ $related := .Site.RegularPages.Related . | first 5 }}
<div class="card-related">
    {{ with .Params.categories }}
        {{ range . }}
        <h3><a href="{{ "/categories/" }}{{ . | urlize }}">{{ . }}</a></h3>
        {{ end }}
    {{ end }}
    <p>-- related --</p>
    <p>{{ partial "icons/ico-poop.html" . }}</p>
    {{ with $related }}
    <div class="related-list">
        <ul>
            {{ range . }}
            <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
            {{ end }}
        </ul>
    </div>
    {{ end }}
</div>

  1. số nhiều của index, google translate