diff options
Diffstat (limited to 'layouts/partials/sidebar.html')
-rw-r--r-- | layouts/partials/sidebar.html | 247 |
1 files changed, 126 insertions, 121 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 1d50d86..74e607c 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,134 +1,139 @@ <!-- Sidebar --> <section id="sidebar"> - <!-- Intro --> - <section id="intro"> - {{ $pic := .Site.Params.intro.pic }} - {{ with $pic.src }} - {{ if $pic.circle }} - <img src="{{ . }}" class="intro-circle" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /> - {{ else if $pic.imperfect }} - <a href="/" class="logo"><img src="{{ . }}" alt="{{ $pic.alt }}" /></a> - {{ else }} - <img src="{{ . }}" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /> - {{ end }} - {{ end }} - {{ with .Site.Params.intro }} - <header> - <h2>{{ .header }}</h2> - <p>{{ .paragraph | safeHTML }}</p> - </header> - {{ end }} - <ul class="icons"> - {{ if and (.RSSLink) (.Site.Params.rssAppearAtTop) }} - <li><a href="{{ .RSSLink }}" type="application/rss+xml" - target="_blank" title="RSS" class="fa fa-rss"></a></li> - {{ end }} - {{ if .Site.Params.socialAppearAtTop }} - {{ partial "social" . }} - {{ end }} - </ul> - </section> - - <!-- Posts List --> - <section id="recent-posts"> - <ul class="posts"> - <header> - <h3>Recent Posts</h3> - </header> - {{ $.Scratch.Set "recentPosts" .Site.Pages }} - - {{ with .Site.Params.postAmount.sidebar }} - {{ $.Scratch.Set "postLimit" . }} - {{ else }} - {{ $.Scratch.Set "postLimit" 5 }} - {{ end }} - - {{ range first ($.Scratch.Get "postLimit") (where ($.Scratch.Get "recentPosts") "Type" "post") }} - <li> - <article> - <header> - <h3><a href="{{ .Permalink }}">{{ .Title }}</a></h3> - {{ $.Scratch.Set "dateType" .Date }} - <time class="published" datetime= - '{{ ($.Scratch.Get "dateType").Format "2006-01-02" }}'> - {{ ($.Scratch.Get "dateType").Format "January 2, 2006" }}</time> - </header> - </article> - </li> - {{ end }} - - {{ if ge (len (where .Site.Pages "Type" "post")) ($.Scratch.Get "postLimit") }} - <li> - <ul class="actions"> - <li><a href= - {{ with .Site.Params.viewMorePostLink }} - {{ . }} - {{ else }} - "/post/" - {{ end }} - class="button">View more posts</a></li> - </ul> - </li> - {{ end }} - </ul> - </section> + <!-- Intro --> + <section id="intro"> + {{ $pic := .Site.Params.intro.pic }} + {{ with $pic.src }} + {{ if $pic.circle }} + <img src="{{ . }}" class="intro-circle" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /> + {{ else if $pic.imperfect }} + <a href="/" class="logo"><img src="{{ . }}" alt="{{ $pic.alt }}" /></a> + {{ else }} + <img src="{{ . }}" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /> + {{ end }} + {{ end }} + {{ with .Site.Params.intro }} + <header> + <h2>{{ .header }}</h2> + <p>{{ .paragraph | safeHTML }}</p> + </header> + {{ end }} + {{ if .Site.Params.socialAppearAtTop }} + <ul class="icons"> + {{ if .RSSLink }} + <li> + <a href="{{ .RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a> + </li> + {{ end }} + {{ partial "social" . }} + </ul> + {{ end }} + </section> - <!-- This if statement only applies if someone goes to the /categories url --> - <!-- Otherwise this section is shown for all other links --> - {{ if ne ($.Scratch.Get "showCategories") false }} - <!-- Categories List --> - <section id="categories"> - <ul class="posts"> - <header> - <h3><a href="/categories/">Categories</a></h3> - </header> + <!-- Posts List --> + <section id="recent-posts"> + <div class="mini-posts"> + <header> + <h3>Recent Posts</h3> + </header> + <div class="posts-container"> + {{ $.Scratch.Set "recentPosts" .Site.Pages }} - {{ if .Site.Params.categoriesByCount }} - {{ $.Scratch.Set "categories" .Site.Taxonomies.categories.ByCount }} - {{ else }} - {{ $.Scratch.Set "categories" .Site.Taxonomies.categories.Alphabetical }} - {{ end }} + {{ with .Site.Params.postAmount.sidebar }} + {{ $.Scratch.Set "postLimit" . }} + {{ else }} + {{ $.Scratch.Set "postLimit" 5 }} + {{ end }} - {{ range $key, $value := $.Scratch.Get "categories" }} - <li> - <article> - <header> - <a href="/categories/{{ $value.Name | urlize }}/">{{ $value.Name }}</a> - <span style="float:right;">{{ $value.Count }}</span> - </header> - </article> - </li> - {{ end }} - </ul> - </section> - {{ end }} + {{ range first ($.Scratch.Get "postLimit") (where ($.Scratch.Get "recentPosts") "Type" "post") }} + <article class="mini-post"> + <header> + <h3> + <a href="{{ .Permalink }}">{{ .Title }}</a> + </h3> + {{ $.Scratch.Set "dateType" .Date }} + <time class="published" datetime='{{ ($.Scratch.Get "dateType").Format "2006-01-02" }}'> + {{ ($.Scratch.Get "dateType").Format "January 2, 2006" }} + </time> + </header> + {{ .Render "featured" }} + </article> + {{ end }} + </div> - <!-- About --> - {{ with .Site.Params.intro.about }} - <section class="blurb"> - <h2>About</h2> - <p>{{ . | safeHTML }}</p> + {{ if ge (len (where .Site.Pages "Type" "post")) ($.Scratch.Get "postLimit") }} + <a href= + {{ with .Site.Params.viewMorePostLink }} + {{ . }} + {{ else }} + "/post/" + {{ end }} + class="button">View more posts</a> + {{ end }} + </div> + </section> - <ul class="actions"> - <li><a href="/about/" class="button">Learn More</a></li> - </ul> - </section> + <!-- This if statement only applies if someone goes to the /categories url --> + <!-- Otherwise this section is shown for all other links --> + {{ if ne ($.Scratch.Get "showCategories") false }} + <!-- Categories List --> + <section id="categories"> + <header> + <h3> + <a href="/categories/">Categories</a> + </h3> + </header> + {{ if .Site.Params.categoriesByCount }} + {{ $.Scratch.Set "categories" .Site.Taxonomies.categories.ByCount }} + {{ else }} + {{ $.Scratch.Set "categories" .Site.Taxonomies.categories.Alphabetical }} {{ end }} - <!-- Footer --> - <section id="footer"> - <ul class="icons"> - {{ if and (.RSSLink) (.Site.Params.rssAppearAtBottom) }} - <li><a href="{{ .RSSLink }}" type="application/rss+xml" - target="_blank" title="RSS" class="fa fa-rss"></a></li> - {{ end }} - {{ if .Site.Params.socialAppearAtBottom }} - {{ partial "social" . }} - {{ end }} - </ul> + {{ range $key, $value := $.Scratch.Get "categories" }} + <article> + <header> + <a href="/categories/{{ $value.Name | urlize }}/">{{ $value.Name }}</a> + <span style="float:right;">{{ $value.Count }}</span> + </header> + </article> + {{ end }} + </section> + {{ end }} - <p class="copyright">{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}© {{ .Site.LastChange.Year }} {{if isset .Site.Params "author" }}{{ .Site.Params.author}}{{ else }}{{ .Site.Title }}{{ end }}{{end}}. Powered by <a href="//gohugo.io" target="_blank">Hugo</a></p> - </section> + <!-- About --> + {{ with .Site.Params.intro.about }} + <section id="mini-bio"> + <h3>About</h1> + <p>{{ . | safeHTML }}</p> + <a href="/about/" class="button">Learn More</a> + </section> + {{ end }} + <!-- Footer --> + <section id="footer"> + {{ if .Site.Params.socialAppearAtBottom }} + <ul class="icons"> + {{ if .RSSLink }} + <li> + <a href="{{ .RSSLink }}" type="application/rss+xml" target="_blank" title="RSS" class="fa fa-rss"></a> + </li> + {{ end }} + {{ partial "social" . }} + </ul> + {{ end }} + <p class="copyright"> + {{ with .Site.Copyright | safeHTML }} + {{ . }} + {{ else }} + © {{ .Site.LastChange.Year }} + {{if isset .Site.Params "author" }} + {{ .Site.Params.author}} + {{ else }} + {{ .Site.Title }} + {{ end }} + {{end}}. + Powered by <a href="//gohugo.io" target="_blank">Hugo</a> + </p> + </section> </section> |