Added heading links.

This commit is contained in:
Greenscreener
2019-07-16 14:29:05 +02:00
parent 61a06697f0
commit 7e3ecdd450
5 changed files with 38 additions and 4 deletions
+9 -2
View File
@@ -73,7 +73,7 @@ $primary: #0b2a37;
.pageHeader {
margin-bottom: 40px;
}
.content h1, h2, h3, h4, h5, h6, .title {
h1,h2,h3,h4,h5,h6,.title {
font-weight: 300;
}
h2 a {
@@ -88,4 +88,11 @@ h2 a {
.separateWithCommas + .separateWithCommas:before {
content: ", ";
}
// /Custom styles
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6, .content .title {
font-weight: 300;
}
.header-link {
margin-right: 5px;
color: $link;
}
// /Custom styles
+10
View File
@@ -0,0 +1,10 @@
document.addEventListener("DOMContentLoaded", () => {
const headings = document.querySelectorAll(".content h1, .content h2, .content h3, .content h4, .content h5, .content h6");
headings.forEach(e => {
const a = document.createElement("a");
a.href = "#" + e.id;
a.innerText = "#";
a.classList.add("header-link");
e.prepend(a);
});
});
@@ -11,6 +11,7 @@
<meta name="theme-color" content="#0b2a37">
{{- end }}
{{ block "js" . -}}
{{ partial "js.html" "js/headerLink.js" }}
{{ partial "js.html" "js/patek-logo-custom-element/patekLogo.js" }}
{{ end }}
<body>
@@ -2,6 +2,6 @@
<h2 class="title pageTitle"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="has-text-grey">{{- T "published" -}}:&nbsp;<time>{{ .PublishDate.Format "02.01.2006 15:04" }}</time></p>
<p class="has-text-grey">
{{- T "author" -}}:{{ range .Params.authors }}{{ with $.Site.GetPage (printf "authors/%s" .) }}<a class="separateWithCommas" href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}{{ end }}
{{- T "author" -}}: {{ range .Params.authors }}{{ with $.Site.GetPage (printf "authors/%s" .) }}<a class="separateWithCommas" href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}{{ end }}
</p>
</div>
</div>