diff options
Diffstat (limited to 'layouts/post/single.html')
-rw-r--r-- | layouts/post/single.html | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/layouts/post/single.html b/layouts/post/single.html new file mode 100644 index 0000000..b97662e --- /dev/null +++ b/layouts/post/single.html @@ -0,0 +1,213 @@ +{{ define "main" }} +<div class="container-fluid bg-clr1 text-nav text-center pb-3 pt-4 position-relative shadow"> + <div style="height:3.5rem;"></div> + <h1>{{ .Title }}</h1> + <p class="description">{{ .Description }}</p> +</div> +<div class="container-fluid bg-nav p-4"> + <div class="row"> + <div class="col-md-3"> + {{ if or (ne .Params.toc false) (ne .Params.toc "false") }} + <div class="bg-mat p-4 rounded"> + <div class="h4 mb-3"> + Contents + </div> + {{ .TableOfContents }} + </div> + {{ end }} + </div> + <div class="col-md-9"> + {{- $postMetaTop := false }} + {{- $postMetaBottom := false }} + {{- range site.Params.position.postMeta }} + {{- if eq .content "top" }} + {{- $postMetaTop = true }} + {{- else if eq .content "bottom" }} + {{- $postMetaBottom = true }} + {{- end }} + {{- end }} + + {{ if or (and site.Params.social.share (eq site.Params.position.social.share "top")) (and site.Params.position.postMeta $postMetaTop) (and (site.Params.position.postMeta.tags.content) (eq site.Params.position.postMeta.tags.content "top")) }} + <div class="py-1"> + + + {{- if and site.Params.position.postMeta $postMetaTop }} + <div class="d-inline mr-auto small text-muted post-meta"> + + {{- $wordCount := "" }} + {{- $readingTime := "" }} + {{- $author := "" }} + {{- $lastUpdated := "" }} + + {{- if and site.Params.position.postMeta.wordCount.content (eq site.Params.position.postMeta.wordCount.content "top") }} + {{- $wordCount = print (.WordCount) " words" }} + {{- end }} + {{- if and site.Params.position.postMeta.readingTime.content (eq site.Params.position.postMeta.readingTime.content "top") }} + {{- $readingTime = print (lang.NumFmt 0 (div .WordCount 130)) " min read" -}} + {{- end }} + {{- if and site.Params.position.postMeta.author.content (eq site.Params.position.postMeta.author.content "top") }} + {{- $author = print "By " (default site.Params.meta.author .Params.author) }} + {{- end }} + {{- if .Lastmod }} + {{- if and site.Params.position.postMeta.lastUpdated.content (eq site.Params.position.postMeta.lastUpdated.content "top") }} + {{- $lastUpdated = print "<span class=''>Last updated: " (.Lastmod.Format "January 2, 2006") }}</span> + {{- end }} + {{- end }} + + {{- $postMetaPre := slice $author $wordCount $readingTime $lastUpdated }} + {{ $postMeta := slice }} + {{ range $postMetaPre }} + {{ if . }} + {{ $postMeta = $postMeta | append . }} + {{ end }} + {{ end }} + + {{- delimit $postMeta " · " -}} + + </div> + {{ end }} + + {{ if and site.Params.social.share (eq site.Params.position.social.share "top") }} + <div class="d-inline ml-auto float-right"> + Share on: + <span class="lead"> + {{ if in site.Params.social.share "facebook" }} + <a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}"e={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Facebook" aria-label="Share on Facebook"><span class="fab fa-facebook"></span></a> + {{ end }} + {{ if in site.Params.social.share "twitter" }} + <a href="https://twitter.com/intent/tweet?source={{ .Permalink }}&text={{ .Title }}:%0A{{ .Permalink }}" rel="noreferrer nofollow" target="_blank" title="Share on Twitter" aria-label="Share on Twitter"><span class="fab fa-twitter"></span></a> + {{ end }} + {{ if in site.Params.social.share "linkedin" }} + <a href="https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}&title={{ .Title }}&summary={{ .Params.description }}&source={{ site.Title }}" rel="noreferrer nofollow" target="_blank" title="Share on LinkedIn" aria-label="Share on LinkedIn"><span class="fab fa-linkedin"></span></a> + {{ end }} + {{ if in site.Params.social.share "telegram" }} + <a href="https://t.me/share/url?url={{ .Permalink }}&text={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Telegram" aria-label="Share on Telegram"><span class="fab fa-telegram"></span></a> + {{ end }} + {{ if in site.Params.social.share "whatsapp" }} + <a href="whatsapp://send?text={{ .Permalink }}%0A%0A{{ .Title }}" data-text="{{ .Title }}" data-href="{{ .Permalink }}" rel="noreferrer nofollow" target="_blank" title="Share on Whatsapp" aria-label="Share on Whatsapp"><span class="fab fa-whatsapp"></span></a> + {{ end }} + {{ if in site.Params.social.share "reddit" }} + <a href="https://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Reddit" aria-label="Share on Reddit"><span class="fab fa-reddit"></span></a> + {{ end }} + {{ if in site.Params.social.share "email" }} + <a href="mailto:?subject={{ .Title }}&body={{ .Params.description }}%0A%0A{{ .Permalink }}" target="_blank" title="Share via email" aria-label="Share via email"><span class="fas fa-envelope"></span></a> + {{ end }} + </span> + </div> + {{ end }} + + {{ if and (site.Params.position.postMeta.tags.content) (eq site.Params.position.postMeta.tags.content "top") }} + <div class="pt-2 pb-3"> + <span class="">Tags:</span> + {{- range .Params.tags -}} + <a href="/tags/{{ . | urlize }}"><span class="badge badge-pill bg-clr2 text-nav mr-2 py-2">{{ . | humanize | upper }}</span></a> + {{- end -}} + </div> + {{ end }} + + </div> + {{ end }} + + <div class="py-3"> + {{ .Content }} + </div> + + + {{ if or (and site.Params.social.share (eq site.Params.position.social.share "bottom")) (and site.Params.position.postMeta $postMetaBottom) (and (site.Params.position.postMeta.tags.content) (eq site.Params.position.postMeta.tags.content "bottom")) }} + <div class="pt-4 mt-2 border-top"> + + + {{- if and site.Params.position.postMeta $postMetaBottom }} + <div class="d-inline mr-auto small text-muted post-meta mb-1"> + + {{- $wordCount := "" }} + {{- $readingTime := "" }} + {{- $author := "" }} + {{- $lastUpdated := "" }} + + {{- if and site.Params.position.postMeta.wordCount.content (eq site.Params.position.postMeta.wordCount.content "bottom") }} + {{- $wordCount = print (.WordCount) " words" }} + {{- end }} + {{- if and site.Params.position.postMeta.readingTime.content (eq site.Params.position.postMeta.readingTime.content "bottom") }} + {{- $readingTime = print (lang.NumFmt 0 (div .WordCount 130)) " min read" -}} + {{- end }} + {{- if and site.Params.position.postMeta.author.content (eq site.Params.position.postMeta.author.content "bottom") }} + {{- $author = print "By " (default site.Params.meta.author .Params.author) }} + {{- end }} + {{- if .Lastmod }} + {{- if and site.Params.position.postMeta.lastUpdated.content (eq site.Params.position.postMeta.lastUpdated.content "bottom") }} + {{- $lastUpdated = print "<span class=''>Last updated: " (.Lastmod.Format "January 2, 2006") }}</span> + {{- end }} + {{- end }} + + {{- $postMetaPre := slice $author $wordCount $readingTime $lastUpdated }} + {{ $postMeta := slice }} + {{ range $postMetaPre }} + {{ if . }} + {{ $postMeta = $postMeta | append . }} + {{ end }} + {{ end }} + + {{- delimit $postMeta " · " -}} + + </div> + {{ end }} + + {{ if and site.Params.social.share (eq site.Params.position.social.share "bottom") }} + <div class="d-inline ml-auto float-right"> + Share on: + <span class="lead"> + {{ if in site.Params.social.share "facebook" }} + <a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}"e={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Facebook" aria-label="Share on Facebook"><span class="fab fa-facebook"></span></a> + {{ end }} + {{ if in site.Params.social.share "twitter" }} + <a href="https://twitter.com/intent/tweet?source={{ .Permalink }}&text={{ .Title }}:%0A{{ .Permalink }}" rel="noreferrer nofollow" target="_blank" title="Share on Twitter" aria-label="Share on Twitter"><span class="fab fa-twitter"></span></a> + {{ end }} + {{ if in site.Params.social.share "linkedin" }} + <a href="https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}&title={{ .Title }}&summary={{ .Params.description }}&source={{ site.Title }}" rel="noreferrer nofollow" target="_blank" title="Share on LinkedIn" aria-label="Share on LinkedIn"><span class="fab fa-linkedin"></span></a> + {{ end }} + {{ if in site.Params.social.share "telegram" }} + <a href="https://t.me/share/url?url={{ .Permalink }}&text={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Telegram" aria-label="Share on Telegram"><span class="fab fa-telegram"></span></a> + {{ end }} + {{ if in site.Params.social.share "whatsapp" }} + <a href="whatsapp://send?text={{ .Permalink }}%0A%0A{{ .Title }}" data-text="{{ .Title }}" data-href="{{ .Permalink }}" rel="noreferrer nofollow" target="_blank" title="Share on Whatsapp" aria-label="Share on Whatsapp"><span class="fab fa-whatsapp"></span></a> + {{ end }} + {{ if in site.Params.social.share "reddit" }} + <a href="https://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" rel="noreferrer nofollow" target="_blank" title="Share on Reddit" aria-label="Share on Reddit"><span class="fab fa-reddit"></span></a> + {{ end }} + {{ if in site.Params.social.share "email" }} + <a href="mailto:?subject={{ .Title }}&body={{ .Params.description }}%0A%0A{{ .Permalink }}" target="_blank" title="Share via email" aria-label="Share via email"><span class="fas fa-envelope"></span></a> + {{ end }} + </span> + </div> + {{ end }} + + + + + {{ if and (site.Params.position.postMeta.tags.content) (eq site.Params.position.postMeta.tags.content "bottom") }} + <div class="mt-3"> + <span class="">Tags:</span> + {{- range .Params.tags -}} + <a href="/tags/{{ . | urlize }}"><span class="badge badge-pill bg-clr2 text-nav mr-2 py-2">{{ . | humanize | upper }}</span></a> + {{- end -}} + </div> + {{ end }} + + </div> + {{ end }} + </div> + </div> + + {{ if site.DisqusShortname }} + <div class="my-5"> + {{ if eq hugo.Environment "production" -}} + {{ template "_internal/disqus.html" . }} + {{ else }} + <p class="lead text-center">This is where Disqus comments would appear on production website.</p> + {{ end }} + </div> + {{ end }} + +</div> +{{ end }} |