single.html 1.9 KB
Newer Older
Miykael_xxm's avatar
init  
Miykael_xxm 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
{{ define "styles" }}
    {{ $.Scratch.Set "style_opts" (dict "src" "scss/pages/post.scss" "dest" "css/post.css") }}
{{ end }}

{{ define "main" }}
    {{ $dateFormat := .Site.Params.dateFormat | default "Jan 2 2006" }}

    <div class="flex-wrapper">
      <div class="post__container">
        <div class="post">
          <header class="post__header">
            <h1 id="post__title">{{.Title}}</h1>
            {{ if .Date }}<time datetime="{{ .Date }}" class="post__date">{{ .Date.Format $dateFormat }}</time> {{ end }}
          </header>
          <article class="post__content">
              {{ partial "anchored-headings.html" .Content }}
              {{ if or .Params.math .Site.Params.math }}
                  {{ partial "math.html" . }}
              {{ end }}
          </article>
          {{ partial "tags.html" .}} {{ partial "post-pagination.html" .}}
          {{ template "_internal/disqus.html" . }}
          <footer class="post__footer">
            {{ partial "social-icons.html" .}}
            <p>{{ replace .Site.Copyright "{year}" now.Year }}</p>
          </footer>
          </div>
      </div>
      {{ if .Params.toc }}
      <div class="toc-container">
          {{ if .Site.Params.showPageTitleInTOC }} <div class="toc-post-title">{{ .Title }}</div> {{ end }}
        {{ .TableOfContents }}
      </div>
      {{ end }}
    </div>
    
{{ end }} 

{{ define "scripts" }}
  {{/* Hardcode a specific prismjs version to avoid a redirect on every page load. */}}
  <script src="https://unpkg.com/prismjs@1.20.0/components/prism-core.min.js"></script>

  {{/* Automatically loads the needed languages to highlight the code blocks. */}}
  <script src="https://unpkg.com/prismjs@1.20.0/plugins/autoloader/prism-autoloader.min.js"
    data-autoloader-path="https://unpkg.com/prismjs@1.20.0/components/"></script>

  {{ if .Params.toc }}
    <script src="/js/table-of-contents.js"></script>
  {{ end }}

{{ end }}