forked from themefisher/airspace-hugo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request themefisher#82 from rahulpnath/sidebarWidgets
Making sidebar content as widgets
- Loading branch information
Showing
6 changed files
with
56 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,4 @@ | ||
{{- $sidebarWidgets := .Site.Params.widgets.sidebar -}} | ||
<aside class="sidebar"> | ||
<!-- Widget Latest Posts --> | ||
<div class="widget widget-latest-post"> | ||
<h4 class="widget-title">{{ i18n "latest_posts" }}</h4> | ||
{{ range first 4 (where .Site.Pages "Type" "post") }} | ||
<div class="media"> | ||
<a class="pull-left" href="{{ .Permalink }}"> | ||
<img class="media-object" src="{{ .Params.Image | relURL }}" alt="{{ .Title }}"> | ||
</a> | ||
<div class="media-body"> | ||
<h4 class="media-heading"><a href="{{ .Permalink }}">{{ .Title }}</a></h4> | ||
<p>{{ .Summary | truncate 50 }}</p> | ||
</div> | ||
</div> | ||
{{ end }} | ||
</div> | ||
<!-- End Latest Posts --> | ||
|
||
<!-- Widget Category --> | ||
<div class="widget widget-category"> | ||
<h4 class="widget-title">{{ i18n "categories" }}</h4> | ||
{{- if isset .Site.Taxonomies "categories" }} | ||
{{- if not (eq (len .Site.Taxonomies.categories) 0) }} | ||
<ul class="widget-category-list"> | ||
{{- range $name, $items := .Site.Taxonomies.categories }} | ||
<li><a href="{{ `categories/` | relLangURL }}{{ $name | urlize | lower }}">{{ $name | title | humanize }}</a></li> | ||
{{- end }} | ||
</ul> | ||
{{- end }} | ||
{{- end }} | ||
</div> <!-- End category --> | ||
|
||
<!-- Widget tag --> | ||
<div class="widget widget-tag"> | ||
<h4 class="widget-title">{{ i18n "tags" }}</h4> | ||
{{- if isset .Site.Taxonomies "tags" }} | ||
{{- if not (eq (len .Site.Taxonomies.tags) 0) }} | ||
<ul class="widget-tag-list"> | ||
{{- range $name, $items := .Site.Taxonomies.tags }} | ||
<li><a href="{{ `tags/` | relLangURL }}{{ $name | urlize | lower }}">{{ $name | humanize }}</a></li> | ||
{{- end }} | ||
</ul> | ||
{{- end }} | ||
{{- end }} | ||
</div> <!-- End tag --> | ||
{{- partial "widgets/widget_area" ( dict "Widgets" $sidebarWidgets "Scope" . ) -}} | ||
</aside> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="widget widget-latest-post"> | ||
<h4 class="widget-title">{{ i18n "latest_posts" }}</h4> | ||
{{ range first 4 (where .Site.Pages "Type" "post") }} | ||
<div class="media"> | ||
<a class="pull-left" href="{{ .Permalink }}"> | ||
<img class="media-object" src="{{ .Params.Image | relURL }}" alt="{{ .Title }}"> | ||
</a> | ||
<div class="media-body"> | ||
<h4 class="media-heading"><a href="{{ .Permalink }}">{{ .Title }}</a></h4> | ||
<p>{{ .Summary | truncate 50 }}</p> | ||
</div> | ||
</div> | ||
{{ end }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="widget widget-category"> | ||
<h4 class="widget-title">{{ i18n "categories" }}</h4> | ||
{{- if isset .Site.Taxonomies "categories" }} | ||
{{- if not (eq (len .Site.Taxonomies.categories) 0) }} | ||
<ul class="widget-category-list"> | ||
{{- range $name, $items := .Site.Taxonomies.categories }} | ||
<li><a href="{{ `categories/` | relLangURL }}{{ $name | urlize | lower }}">{{ $name | title | humanize }}</a></li> | ||
{{- end }} | ||
</ul> | ||
{{- end }} | ||
{{- end }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="widget widget-tag"> | ||
<h4 class="widget-title">{{ i18n "tags" }}</h4> | ||
{{- if isset .Site.Taxonomies "tags" }} | ||
{{- if not (eq (len .Site.Taxonomies.tags) 0) }} | ||
<ul class="widget-tag-list"> | ||
{{- range $name, $items := .Site.Taxonomies.tags }} | ||
<li><a href="{{ `tags/` | relLangURL }}{{ $name | urlize | lower }}">{{ $name | humanize }}</a></li> | ||
{{- end }} | ||
</ul> | ||
{{- end }} | ||
{{- end }} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{- range .Widgets -}} | ||
{{- if eq . "search" -}} | ||
{{- if not ( eq $.Scope.Layout "search" ) -}} | ||
{{- partial ( print "widgets/" . ) $.Scope -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- partial ( print "widgets/" . ) $.Scope -}} | ||
{{- end -}} | ||
{{- end -}} |