summaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorroninro <liumy.f@foxmail.com>2022-07-29 12:17:50 +0800
committerroninro <liumy.f@foxmail.com>2022-07-29 12:17:50 +0800
commitf0e8a71001ad71fbeeab702eee7375f9c1d06960 (patch)
treec3ecadc51ce3cb5dc6ff92ad3db369ce20ba8f68 /layouts/_default
parent95e0fb6c9ae5d3403ecb765d6e34d7cd83692f09 (diff)
render-heading with Anchor
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/_markup/render-heading.html1
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/single.html36
3 files changed, 6 insertions, 35 deletions
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html
new file mode 100644
index 0000000..ba737db
--- /dev/null
+++ b/layouts/_default/_markup/render-heading.html
@@ -0,0 +1 @@
+<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}<a class="anchorjs-link" href="#{{ .Anchor | safeURL }}"></a></h{{ .Level }}> \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 2711fee..3b18f33 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -49,6 +49,10 @@
{{ end }}
{{ end }}
+ {{ range .AlternativeOutputFormats -}}
+ {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
+ {{ end -}}
+
</head>
<!-- hack iOS CSS :active style -->
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index c199a65..54f3e8b 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -10,7 +10,7 @@
col-lg-8 col-lg-offset-2
col-md-10 col-md-offset-1
post-container">
-
+ {{ .TableOfContents }}
{{ .Content }}
<hr style="visibility: hidden;" />
@@ -73,38 +73,4 @@
</div>
</article>
-<!-- async load function -->
-<script>
- function async(u, c) {
- var d = document, t = 'script',
- o = d.createElement(t),
- s = d.getElementsByTagName(t)[0];
- o.src = u;
- if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
- s.parentNode.insertBefore(o, s);
- }
-</script>
-<!-- anchor-js, Doc:http://bryanbraun.github.io/anchorjs/ -->
-<script>
- async("//cdnjs.cloudflare.com/ajax/libs/anchor-js/1.1.1/anchor.min.js", function () {
- anchors.options = {
- visible: 'hover',
- placement: 'right',
- // icon: '#'
- };
- anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');
- })
-</script>
-<style>
- /* place left on bigger screen */
- @media all and (min-width: 800px) {
- .anchorjs-link {
- position: absolute;
- left: -0.75em;
- font-size: 1.1em;
- margin-top: -0.1em;
- }
- }
-</style>
-
{{ end }} \ No newline at end of file