mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-17 13:25:57 -06:00
Add better series taxonomy list and clean up post metadata
This commit is contained in:
parent
21180991c0
commit
96893d7de6
@ -4,12 +4,14 @@
|
||||
|
||||
|
||||
/* Post layout (in list pages) */
|
||||
.page-list ul {
|
||||
.page-list ul,
|
||||
.series-taxonomy ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.page-list li {
|
||||
.page-list li,
|
||||
.series-taxonomy li {
|
||||
padding-top: 8px;
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
@ -18,7 +20,8 @@
|
||||
background-color: #222;
|
||||
}
|
||||
|
||||
.page-list li+li {
|
||||
.page-list li+li,
|
||||
.series-taxonomy > ul > li+li {
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
@ -59,6 +62,24 @@
|
||||
|
||||
|
||||
|
||||
/* Series list format */
|
||||
.series-pages ul {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-flow: row wrap;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
background-color: #111;
|
||||
padding: 8px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.series-pages li {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Subsection formatting */
|
||||
.section {
|
||||
margin-bottom: 40px;
|
||||
|
@ -5,7 +5,7 @@
|
||||
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
|
||||
</h2>
|
||||
|
||||
{{ partial "post-metadata.html" . }}
|
||||
{{ partial "post-metadata-short.html" . }}
|
||||
|
||||
{{ with .Resources.GetMatch "feature" }}
|
||||
<div class="post-media">
|
||||
|
19
layouts/partials/authors-meta-item.html
Normal file
19
layouts/partials/authors-meta-item.html
Normal file
@ -0,0 +1,19 @@
|
||||
{{ with .Params.authors }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "user-circle" }}
|
||||
|
||||
{{ if index $.Site.Taxonomies "authors" }}
|
||||
|
||||
{{ $authors := slice }}
|
||||
{{ range . }}
|
||||
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
|
||||
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
|
||||
{{ end }}
|
||||
{{ delimit $authors ", " }}
|
||||
|
||||
{{ else }}
|
||||
{{ delimit . ", " }}
|
||||
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
18
layouts/partials/post-metadata-short.html
Normal file
18
layouts/partials/post-metadata-short.html
Normal file
@ -0,0 +1,18 @@
|
||||
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime }}
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "calendar" }}
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
|
||||
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
|
||||
</time>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "authors-meta-item.html" . }}
|
||||
{{ partial "translations-meta-item.html" . }}
|
||||
{{ partial "readingtime-meta-item.html" . }}
|
||||
{{ partial "series-meta-item.html" . }}
|
||||
{{ partial "tags-meta-item.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
@ -1,4 +1,4 @@
|
||||
{{ if or .Date .IsTranslated .Site.Params.readingtime .Site.Params.repoURL }}
|
||||
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime .Site.Params.gitFileURL }}
|
||||
<div class="post-metadata">
|
||||
{{ if .Date }}
|
||||
<span class="post-meta-item">
|
||||
@ -19,74 +19,11 @@
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.authors }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "user-circle" }}
|
||||
|
||||
{{ if index $.Site.Taxonomies "authors" }}
|
||||
|
||||
{{ $authors := slice }}
|
||||
{{ range . }}
|
||||
{{ $url := (printf "/authors/%s" (. | anchorize)) | absLangURL }}
|
||||
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
|
||||
{{ end }}
|
||||
{{ delimit $authors ", " }}
|
||||
|
||||
{{ else }}
|
||||
{{ delimit . ", " }}
|
||||
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsTranslated }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "world" }}
|
||||
{{ range .Translations }}
|
||||
<a href="{{ .Permalink }}">{{ .Language }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ if ne .Site.Params.readingtime false }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ i18n "readingtime" .ReadingTime }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.gitFileURL }}
|
||||
<span class="post-meta-item">
|
||||
{{ with $.Site.Params.gitFileIcon }}
|
||||
{{ partial "icon.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "icon.html" "file" }}
|
||||
{{ end }}
|
||||
|
||||
<a href="{{ printf "%s/content/%s" . $.File.Path }}" target="_blank" rel="noopener">
|
||||
View source
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.series }}
|
||||
<div class="series">
|
||||
{{ range ($.GetTerms "series") }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "files" }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="tags">
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "tag" }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ partial "authors-meta-item.html" . }}
|
||||
{{ partial "translations-meta-item.html" . }}
|
||||
{{ partial "readingtime-meta-item.html" . }}
|
||||
{{ partial "viewsource-meta-item.html" . }}
|
||||
{{ partial "series-meta-item.html" . }}
|
||||
{{ partial "tags-meta-item.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
6
layouts/partials/readingtime-meta-item.html
Normal file
6
layouts/partials/readingtime-meta-item.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{ if ne .Site.Params.readingtime false }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ i18n "readingtime" .ReadingTime }}
|
||||
</span>
|
||||
{{ end }}
|
10
layouts/partials/series-meta-item.html
Normal file
10
layouts/partials/series-meta-item.html
Normal file
@ -0,0 +1,10 @@
|
||||
{{ with .Params.series }}
|
||||
<div class="series">
|
||||
{{ range ($.GetTerms "series") }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "files" }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
8
layouts/partials/tags-meta-item.html
Normal file
8
layouts/partials/tags-meta-item.html
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="tags">
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "tag" }}
|
||||
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
8
layouts/partials/translations-meta-item.html
Normal file
8
layouts/partials/translations-meta-item.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{ if .IsTranslated }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "world" }}
|
||||
{{ range .Translations }}
|
||||
<a href="{{ .Permalink }}">{{ .Language }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
13
layouts/partials/viewsource-meta-item.html
Normal file
13
layouts/partials/viewsource-meta-item.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{ with .Site.Params.gitFileURL }}
|
||||
<span class="post-meta-item">
|
||||
{{ with $.Site.Params.gitFileIcon }}
|
||||
{{ partial "icon.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "icon.html" "file" }}
|
||||
{{ end }}
|
||||
|
||||
<a href="{{ printf "%s/content/%s" . $.File.Path }}" target="_blank" rel="noopener">
|
||||
View source
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
@ -23,13 +23,64 @@
|
||||
</h1>
|
||||
|
||||
{{ if eq .Kind "taxonomy" }}
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
{{ if eq .Data.Singular "series" }}
|
||||
<div class="series-taxonomy">
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
<div class="post">
|
||||
<h2 class="post-title">
|
||||
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
|
||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
|
||||
</h2>
|
||||
<div class="post-metadata">
|
||||
{{ partial "translations-meta-item.html" . }}
|
||||
|
||||
{{ if ne .Site.Params.readingtime false }}
|
||||
<span class="post-meta-item">
|
||||
{{ partial "icon.html" "clock" }}
|
||||
{{ $readingtime := 0 }}
|
||||
{{ range .Data.Pages }}
|
||||
{{ $readingtime = (add $readingtime .ReadingTime) }}
|
||||
{{ end }}
|
||||
{{ i18n "readingtime" $readingtime }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "viewsource-meta-item.html" . }}
|
||||
</div>
|
||||
|
||||
{{ with .Description }}
|
||||
<div class="post-description">
|
||||
<p>{{ . | markdownify }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="series-pages">
|
||||
<ul>
|
||||
{{ range .Data.Pages.Reverse }}
|
||||
<li>{{ .Render "summary" }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="taxonomy">
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user