|
| 1 | +{{ define "main" }} |
| 2 | + |
| 3 | +<article class="post-single"> |
| 4 | + <header class="post-title"> |
| 5 | + <p> |
| 6 | + {{ if .Date }} |
| 7 | + <time>{{ .Date | time.Format ":date_medium" }}</time> |
| 8 | + {{ end }} |
| 9 | + {{ if or .Params.Author site.Author.name }} |
| 10 | + <span>{{ .Params.Author | default site.Author.name }}</span> |
| 11 | + {{ end }} |
| 12 | + </p> |
| 13 | + <h1>{{ .Title }}</h1> |
| 14 | + </header> |
| 15 | + <section class="post-content">{{ .Content }}</section> |
| 16 | + |
| 17 | + <!-- Post Tags --> |
| 18 | + {{ if .Params.tags }} |
| 19 | + <footer class="post-tags"> |
| 20 | + {{ range .Params.tags }} {{ $href := print (absURL "tags/") (urlize .) }} |
| 21 | + <a href="{{ $href }}">{{ . }}</a> |
| 22 | + {{ end }} |
| 23 | + </footer> |
| 24 | + {{ end }} |
| 25 | + |
| 26 | + <!-- Post Nav --> |
| 27 | + {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}<!----> |
| 28 | + {{ if and (gt (len $pages) 1) (in $pages . ) }} |
| 29 | + <nav class="post-nav"> |
| 30 | + {{ with $pages.Next . }} |
| 31 | + <a class="prev" href="{{ .Permalink }}"><span>←</span><span>{{ .Name }}</span></a> |
| 32 | + {{ end }} {{ with $pages.Prev . }} |
| 33 | + <a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span>→</span></a> |
| 34 | + {{ end }} |
| 35 | + </nav> |
| 36 | + {{ end }} |
| 37 | + |
| 38 | + <!-- Disqus --> |
| 39 | + {{ if and site.DisqusShortname (not (eq .Params.comments false)) }} |
| 40 | + <div id="disqus_thread" class="post-comments"></div> |
| 41 | + <script> |
| 42 | + var disqusShortname = '{{ site.DisqusShortname }}'; |
| 43 | + var script = document.createElement('script'); |
| 44 | + script.src = 'https://' + disqusShortname + '.disqus.com/embed.js'; |
| 45 | + script.setAttribute('data-timestamp', +new Date()); |
| 46 | + document.head.appendChild(script); |
| 47 | + </script> |
| 48 | + {{ end }} |
| 49 | + |
| 50 | + <!-- Mermaid --> |
| 51 | + {{ if .Params.mermaid }} |
| 52 | + <script |
| 53 | + src="https://cdn.staticfile.org/mermaid/8.14.0/mermaid.min.js" |
| 54 | + integrity="md5-cb58961821ec1396e5c283dc07331efd" |
| 55 | + crossorigin="anonymous" |
| 56 | + ></script> |
| 57 | + <script> |
| 58 | + // Replace mermaid pre.code to div |
| 59 | + Array.from(document.getElementsByClassName("language-mermaid")).forEach( |
| 60 | + (el) => { |
| 61 | + el.parentElement.outerHTML = `<div class="mermaid">${el.innerText}</div>`; |
| 62 | + } |
| 63 | + ); |
| 64 | + </script> |
| 65 | + <style> |
| 66 | + /* Set svg to center */ |
| 67 | + .mermaid svg { |
| 68 | + display: block; |
| 69 | + margin: auto; |
| 70 | + } |
| 71 | + </style> |
| 72 | + {{ end }} |
| 73 | + |
| 74 | +</article> |
| 75 | + |
| 76 | +{{ end }} |
0 commit comments