single.html 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {{ define "head" }}
  2. {{ if .Params.images -}}
  3. {{- range first 1 .Params.images -}}
  4. <style>:root{ --bg-img: url({{. | relURL}});}</style>
  5. {{- end -}}
  6. {{- end -}}
  7. {{ end }}
  8. {{ define "header" }}
  9. {{ partial "header.html" . }}
  10. {{ end }}
  11. {{ define "main" }}
  12. <main id="site-main" class="wrapper">
  13. <article>
  14. <header class="post-header">
  15. <div class="title-area">
  16. <a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
  17. <div class="title-area-l">
  18. <div id="post-header-date">{{ .Date.Format .Site.Params.dateform }}</div>
  19. <h1 id="page-title">{{ .Title }}</h1>
  20. </div>
  21. </div>
  22. {{- if .Params.toc }}
  23. <button id="toc-btn" title="目录"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg> 目录</button>
  24. {{- end }}
  25. </header>
  26. {{- if .Params.toc }}
  27. <div id="toc" class="sidebar">
  28. <p class="toc-title">目录</p>
  29. {{ .TableOfContents }}
  30. </div>
  31. {{- end }}
  32. <div class="content">
  33. {{ .Content }}
  34. </div>
  35. <hr class="post-end">
  36. <footer class="post-info">
  37. {{- with .Params.tags }}
  38. <p>
  39. <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7" y2="7"></line></svg>
  40. {{- range . -}}
  41. <span class="tag"><a href="{{ "tags/" | relURL }}{{ . | urlize }}">{{.}}</a></span>
  42. {{- end }}
  43. </p>
  44. {{- end }}
  45. <p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>{{ .WordCount }} Words</p>
  46. <p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat .Site.Params.dateformNumTime .Date.Local }}</p>
  47. {{- if .GitInfo }}
  48. <p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg><a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash }}</a> @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}</p>
  49. {{- end }}
  50. </footer>
  51. </article>
  52. <div class="post-nav">
  53. {{- with .NextInSection }}
  54. <a class="next-post" href="{{ .RelPermalink }}">
  55. <span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>&nbsp;Newer</span><br><span>{{ .Title }}</span>
  56. </a>
  57. {{- end }}
  58. {{- with .PrevInSection }}
  59. <a class="prev-post" href="{{ .RelPermalink }}">
  60. <span class="post-nav-label">Older&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
  61. </a>
  62. {{- end }}
  63. </div>
  64. <button type="button" id="scroll-top-btn" title="回到顶部"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-up-circle"><circle cx="12" cy="12" r="10"></circle><polyline points="16 12 12 8 8 12"></polyline><line x1="12" y1="16" x2="12" y2="8"></line></svg></button>
  65. {{ partialCached "comments.html" . }}
  66. </main>
  67. {{ end }}
  68. {{ define "footer" }}
  69. {{ partialCached "footer.html" . }}
  70. {{ end }}