Add development styles and DRAFT tags; update layout of list and single templates

This commit is contained in:
Eryn Wells 2021-12-26 13:04:55 -07:00
parent 9d428d8913
commit 7cf5efa991
5 changed files with 54 additions and 28 deletions

View file

@ -5,19 +5,31 @@
<h1 class="main-title">{{ .Title }}</h1>
{{ end }}
<!-- $pages -->
{{ $pages := union .RegularPages .Sections }}
<!---->{{ if .IsHome }} {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ if .IsHome }}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ end }}
{{ .Content }}
<!-- Articles -->
{{ $paginator := .Paginate $pages }} {{ range $index, $page := $paginator.Pages }}
<article class="post-entry">
<h2>{{ .Title }}</h2>
<time>{{ .Date | time.Format "Jan 2, 2006" }}</time>
<a href="{{ .Permalink }}"></a>
</article>
<ul class="post-list">
{{ $paginator := .Paginate $pages }}
{{ range $index, $page := $paginator.Pages }}
<li class="post-entry">
<header>
<h2>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
<time datetime="{{ .Date | time.Format " 2006-01-02" }}">{{ .Date | time.Format "Jan 2, 2006" }}</time>
{{ partial "development/draft_tag.html" . }}
</header>
{{ if .Description }}
<article>{{ .Description }}</article>
{{ end }}
</li>
{{ end }}
</ul>
<!-- Main Nav -->
{{ if gt $paginator.TotalPages 1 }}

View file

@ -1,20 +1,19 @@
{{ define "main" }}
<article class="post-single">
<header class="post-title">
<p>
<time>{{ .Date | time.Format "Jan 2, 2006" }}</time>
</p>
<h1>{{ .Title }}</h1>
<h1>{{ .Title }}{{ partial "development/draft_tag.html" . }}</h1>
<span class="post-date"><time>{{ .Date | time.Format "Jan 2, 2006" }}</time></p>
</header>
<section class="post-content">{{ .Content }}</section>
<!-- Post Tags -->
{{ if .Params.tags }}
<footer class="post-tags">
<footer>
<ul class="post-tags">
{{ range .Params.tags }} {{ $href := print (absURL "tags/") (urlize .) }}
<a href="{{ $href }}">{{ . }}</a>
<li><a href="{{ $href }}">{{ . }}</a></li>
{{ end }}
</ul>
</footer>
{{ end }}
@ -29,18 +28,5 @@
{{ end }}
</nav>
{{ end }}
<!-- Disqus -->
{{ if and site.DisqusShortname (not (eq .Params.comments false)) }}
<div id="disqus_thread" class="post-comments"></div>
<script>
var disqusShortname = '{{ site.DisqusShortname }}';
var script = document.createElement('script');
script.src = 'https://' + disqusShortname + '.disqus.com/embed.js';
script.setAttribute('data-timestamp', +new Date());
document.head.appendChild(script);
</script>
{{ end }}
</article>
{{ end }}

View file

@ -0,0 +1,3 @@
{{ if in (.Site.BaseURL | string) "localhost" }}
{{ if .IsDraft }}<span class="draft">draft</span>{{ end }}
{{ end }}

View file

@ -19,6 +19,9 @@
{{ range $stylesheet := .Resources.Match "*.css" }}
<link rel="preload stylesheet" as="style" href="{{ $stylesheet.Permalink }}">
{{ end }}
{{ if in (.Site.BaseURL | string) "localhost" }}
<link rel="preload stylesheet" as="style" href="/styles/development.css">
{{ end }}
{{ if and .IsPage (not site.Params.disableHLJS) }}
<link rel="preload stylesheet" as="style" href="{{ `styles/an-old-hope.min.css` | absURL }}" />

View file

@ -0,0 +1,22 @@
/* development.css
* Some styles for development UI.
* Eryn Wells <eryn@erynwells.me>
*/
.draft {
color: red;
display: inline-block;
font-family: 'SF Pro', sans-serif;
font-size: 1.5rem;
letter-spacing: 3px;
margin-inline-start: 1rem;
text-transform: uppercase;
}
.draft:before {
content: "[";
}
.draft:after {
content: "]";
}