The issue: Using integer as tags (e.g. 2025) is supported by hugo, but printf here converts it to `sint2025`.
An easy client-side solution would be to add quotes to the tag `"2025"`, but it's not intuitive.
Instead, we let hugo choose how to do the conversion.
Working tags:
- `NoSpace` => `tags/nospace/`
- `Two Words` => `tags/two-words/`
- `2025` => `tags/2025/`
- `2025.1` => `tags/2025.1/`
- `1/2` => `tags/1/2/`
- `✔️` => `tags/%EF%B8%8F/`
Breaking change:
- `1\2` => `tags/1/2` but was and should be `tags/1\2` (or `tags/1%5C2`)
IMO we can ignore this case, which can produce other weird behaviours
69 lines
2.0 KiB
HTML
69 lines
2.0 KiB
HTML
{{ define "main" }}
|
|
{{ if .Content }}
|
|
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
|
|
{{ .Content }}
|
|
</div>
|
|
{{ end }}
|
|
<div class="posts">
|
|
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
|
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
|
|
|
{{ $PageContext := . }}
|
|
{{ if .IsHome }}
|
|
{{ $PageContext = .Site }}
|
|
{{ end }}
|
|
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
|
|
|
|
{{ range $paginator.Pages }}
|
|
<article class="post on-list">
|
|
<h1 class="post-title">
|
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
|
</h1>
|
|
|
|
<div class="post-meta">
|
|
{{- if .Date -}}
|
|
<time class="post-date">
|
|
{{- .Date.Format "2006-01-02" -}}
|
|
</time>
|
|
{{- end -}}
|
|
{{- with .Params.Author -}}
|
|
<span class="post-author">{{ . }}</span>
|
|
{{- end -}}
|
|
<!-- comments counter -->
|
|
{{ partial "comments_counter.html" . }}
|
|
</div>
|
|
|
|
{{ if .Params.tags }}
|
|
<span class="post-tags">
|
|
{{ range .Params.tags }}
|
|
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">
|
|
{{- . -}}
|
|
</a>
|
|
{{ end }}
|
|
</span>
|
|
{{ end }}
|
|
|
|
{{ partial "cover.html" . }}
|
|
|
|
<div class="post-content">
|
|
{{ if .Params.showFullContent }}
|
|
{{ .Content }}
|
|
{{ else if .Description }}
|
|
{{ .Description | markdownify }}
|
|
{{ else }}
|
|
{{ .Summary }}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if not .Params.showFullContent }}
|
|
<div>
|
|
<a class="read-more button" href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
|
</div>
|
|
{{ end }}
|
|
</article>
|
|
{{ end }}
|
|
|
|
{{ partial "pagination.html" . }}
|
|
</div>
|
|
{{ end }}
|