Jacky Zhao
2021-12-28 e4caa0d1d7fb3bdca6dee07fee299a3acdf40043
add taxonomy and term lists
3 files added
4 files modified
189 ■■■■ changed files
assets/base.scss 93 ●●●● patch | view | raw | blame | history
config.toml 3 ●●●● patch | view | raw | blame | history
layouts/_default/section.html 16 ●●●●● patch | view | raw | blame | history
layouts/_default/single.html 5 ●●●●● patch | view | raw | blame | history
layouts/_default/taxonomy.html 33 ●●●●● patch | view | raw | blame | history
layouts/_default/term.html 24 ●●●●● patch | view | raw | blame | history
layouts/partials/page-list.html 15 ●●●●● patch | view | raw | blame | history
assets/base.scss
@@ -108,25 +108,86 @@
  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 {
config.toml
@@ -8,7 +8,8 @@
    "/content/templates/*",
    "/content/private/*",
]
summaryLength = 35
summaryLength = 20
paginate = 10
enableGitInfo = true
[markup]
layouts/_default/section.html
@@ -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>
layouts/_default/single.html
@@ -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>
layouts/_default/taxonomy.html
New 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>
layouts/_default/term.html
New 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>
layouts/partials/page-list.html
New 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>