Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/papercss-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Betz <zwbetz@gmail.com>2019-02-27 06:04:07 +0300
committerZachary Betz <zwbetz@gmail.com>2019-02-27 06:04:07 +0300
commit9134c0596ed4f0b0a6f2118d58123697dc4d17a7 (patch)
tree8bc6e716b3fefc3865edebcd76ee044db180cba8 /layouts
parent7ab6197b5742851d0a138abe5720d3ce768f7b54 (diff)
List font size, toc, anchor styles
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/terms.html4
-rw-r--r--layouts/partials/post-list.html4
-rw-r--r--layouts/partials/toc.html21
-rw-r--r--layouts/post/single.html6
4 files changed, 31 insertions, 4 deletions
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index 0f0bcca..e92be4a 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -6,11 +6,11 @@
{{ $name := .Name }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
- <h3>
+ <h2 class="post-list">
<a href="{{ .Permalink }}">
{{ printf "(%d) %s" $count $name }}
</a>
- </h3>
+ </h2>
{{ end }}
{{ end }}
diff --git a/layouts/partials/post-list.html b/layouts/partials/post-list.html
index 00d60a2..2ee64b7 100644
--- a/layouts/partials/post-list.html
+++ b/layouts/partials/post-list.html
@@ -1,8 +1,8 @@
<h1>{{ .Title }}</h1>
{{ range where .Pages.ByPublishDate.Reverse "Section" "post" }}
-<h3>
+<h2 class="post-list">
<a href="{{ .Permalink }}">
{{ .Title }}
</a>
-</h3>
+</h2>
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..8879bd6
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,21 @@
+{{ $headings := findRE "<h2.*?>(.|\n])+?</h2>" .Content }}
+{{ if ge (len $headings) 2 }}
+<div class="child-borders">
+ <div class="toc border" aria-labelledby="toc-heading">
+ <h2 id="toc-heading">Table of contents</h2>
+ <ol>
+ {{ range $headings }}
+ <li>
+ {{ $id := findRE "id=\".*\"" . }}
+ {{ $id = index $id 0 }}
+ {{ $id = strings.TrimPrefix "id=\"" $id }}
+ {{ $id = strings.TrimSuffix "\"" $id }}
+ <a href="#{{ $id }}">
+ {{ . | htmlUnescape | plainify }}
+ </a>
+ </li>
+ {{ end }}
+ </ol>
+ </div>
+</div>
+{{ end }} \ No newline at end of file
diff --git a/layouts/post/single.html b/layouts/post/single.html
index c5476fb..104653b 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -1,6 +1,7 @@
{{ define "main" }}
<h1 class="post-title">{{ .Title }}</h1>
+
{{ $dateFormat := $.Site.Params.dateFormat | default "Jan 2, 2006" }}
<strong>Publish date: </strong>{{ .PublishDate.Format $dateFormat }}
<br>
@@ -10,6 +11,11 @@
<a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }}
+
+{{ if ne .Params.toc false }}
+ {{ partial "toc.html" . }}
+{{ end }}
+
{{ .Content }}
{{ end }} \ No newline at end of file