add taxonomy and term lists

This commit is contained in:
Jacky Zhao 2021-12-27 19:35:42 -05:00
parent a45856d788
commit e4caa0d1d7
7 changed files with 157 additions and 32 deletions

View File

@ -108,25 +108,86 @@ td, th {
margin: 0.5em 0;
}
.pagination {
list-style: none;
padding-left: 0;
display: flex;
margin-top: 2em;
gap: 1.5em;
justify-content: center;
& > li {
text-align: center;
display: inline-block;
& a {
background-color: transparent !important;
}
& a[href$="#"] {
opacity: 0.2;
}
}
}
.section {
& h3 > a {
font-weight: 700;
font-family: Inter;
margin: 0;
}
& p {
margin-top: 0;
}
}
article {
& > .meta {
margin: -1.5em 0 1em 0;
opacity: 0.7;
}
& > .meta {
margin: -1.5em 0 1em 0;
opacity: 0.7;
}
& a {
font-family: Source Sans Pro;
font-weight: 600;
& > .tags {
list-style: none;
padding-left: 0;
// internal link
&[href^="./"], &[href^="/"] {
text-decoration: none;
background-color: transparentize(#8f9fa9, 0.85);
padding: 0 0.1em;
margin: auto -0.1em;
border-radius: 3px;
}
}
& .meta {
& > h1 {
margin: 0;
}
& > p {
margin: 0;
}
}
& > li {
display: inline-block;
}
& > li > a {
border-radius: 8px;
border: var(--outlinegray) 1px solid;
padding: 0.2em 0.5em;
&::before {
content: "#";
margin-right: 0.3em;
color: var(--outlinegray);
}
}
}
& a {
font-family: Source Sans Pro;
font-weight: 600;
// internal link
&[href^="./"], &[href^="/"] {
text-decoration: none;
background-color: transparentize(#8f9fa9, 0.85);
padding: 0 0.1em;
margin: auto -0.1em;
border-radius: 3px;
}
}
}
.backlinks a {

View File

@ -8,7 +8,8 @@ ignoreFiles = [
"/content/templates/*",
"/content/private/*",
]
summaryLength = 35
summaryLength = 20
paginate = 10
enableGitInfo = true
[markup]

View File

@ -14,21 +14,7 @@
</header>
<article>
<h1>All {{.Title}}</h1>
<ul class="section-ul">
{{- range .Pages.ByLastmod.Reverse -}}
<li class="section-li">
<div class="section">
<div class="desc">
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
<p>{{- .Summary -}}{{if .Truncated}}...{{end}}</p>
</div>
<p class="meta">
{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
</p>
</div>
</li>
{{- end -}}
</ul>
{{partial "page-list.html" .Pages.ByLastmod.Reverse }}
</article>
{{partial "contact.html" .}}
</div>

View File

@ -17,6 +17,11 @@
<p class="meta">
Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
</p>
<ul class="tags">
{{ range (.GetTerms "tags") }}
<li><a href="{{ .Permalink }}">{{ .LinkTitle | humanize }}</a></li>
{{ end }}
</ul>
{{if $.Site.Data.config.enableToc}}
<aside class="mainTOC">
<h3>Table of Contents</h3>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{partial "search.html" .}}
<div class="singlePage">
<!-- Begin actual content -->
<header>
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
<div class="spacer"></div>
{{partial "darkmode.html" .}}
</header>
<article>
<h1>All {{.Title}}</h1>
<div class="tags">
{{ range .Site.Taxonomies.tags.ByCount }}
<div class="meta">
<h1><a href="{{ .Page.Permalink }}">{{ .Page.Title | humanize }}</a></h1>
<p><b>{{ .Count }}</b> notes with this tag {{if gt .Count 2}}(showing first 2 results){{end}}</p>
</div>
{{ with ($.Site.GetPage (printf "/tags/%s" .Page.Title)) }}
{{partial "page-list.html" (first 2 .Pages.ByLastmod.Reverse)}}
{{ end }}
{{ end }}
</div>
</article>
{{partial "contact.html" .}}
</div>
</body>
</html>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{partial "search.html" .}}
<div class="singlePage">
<!-- Begin actual content -->
<header>
<h1 id="page-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Data.config.page_title }}</a></h1>
<svg tabindex="0" id="search-icon" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg>
<div class="spacer"></div>
{{partial "darkmode.html" .}}
</header>
<article>
<h1>Category: {{.Title | humanize}}</h1>
{{partial "page-list.html" .Paginator.Pages}}
{{ template "_internal/pagination.html" . }}
</article>
{{partial "contact.html" .}}
</div>
</body>
</html>

View File

@ -0,0 +1,15 @@
<ul class="section-ul">
{{- range . -}}
<li class="section-li">
<div class="section">
<div class="desc">
<h3><a href="{{ .Permalink }}">{{- .Title -}}</a></h3>
<p>{{- .Summary -}}{{if .Truncated}}...{{end}}</p>
</div>
<p class="meta">
{{ .ReadingTime }} minute read. Last updated {{if ne .Date .Lastmod}}{{ .Lastmod.Format "January 2, 2006" }}{{else}}Unknown{{end}}
</p>
</div>
</li>
{{- end -}}
</ul>