Skip to content

Commit

Permalink
revise styles for displaying draft posts
Browse files Browse the repository at this point in the history
  • Loading branch information
htr3n committed Nov 27, 2018
1 parent 77613eb commit 9cd5abf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion assets/scss/hyde-hyde/_misc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
color: #333;
border-radius: 2px;
padding: 1px 5px;
}
}

.text-center {
text-align: center;
Expand All @@ -19,3 +19,7 @@
.pull-right {
float: right;
}

.draft {
color: #999 !important;
}
11 changes: 9 additions & 2 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
<div class="post-list">
{{ $paginator := .Paginate (where .Data.Pages "Type" "posts") }}
{{ range $paginator.Pages }}
{{ if .Draft }}
{{ .Scratch.Set "draftPage" true }}
{{ else }}
{{ .Scratch.Set "draftPage" false }}
{{ end }}
<div class="post-list__item">
<span class="item__title--big">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ if .Draft }}<sup><i class="fas fa-comment-dots fa-xs"></i></sup>{{ end }}
<a href="{{ .RelPermalink }}" {{if .Scratch.Get "draftPage" }}class="draft"{{end}}>{{ .Title }}</a>
</span>
<span class="item__date">
{{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }}
</span>
<span {{if .Scratch.Get "draftPage" }}class="draft"{{end}}>
{{ if .Description }}
{{ .Description }}
{{ else }}
{{ .Summary }}
{{ end }}
</span>
{{ if .Truncated }}
... <a class="read-more-symbol" href="{{ .RelPermalink }}"></a>
{{ end }}
</div>
{{ .Scratch.Delete "draftPage" }}
{{ end }}
</div>
{{ partial "pagination.html" . }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/posts-list.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ range . }}
<li>
<span class="list__title--small">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<a href="{{ .RelPermalink }}" {{if .Draft}}class="draft"{{end}}>{{ .Title }}</a>
{{if not .Date.IsZero}}
<time class="pull-right hidden-tablet">{{.Date.Format ("Jan 02 '06")}}</time>
{{end}}
</span>
</li>
{{ end }}
{{ end }}

0 comments on commit 9cd5abf

Please sign in to comment.