Move the rest of the _default templates from the theme

This commit is contained in:
Eryn Wells 2021-10-10 10:32:26 -07:00
parent 512c8ec2da
commit 8c4dd830b9
3 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,40 @@
{{ define "main" }}
<!-- Main Title -->
{{ if .Title }}
<h1 class="main-title">{{ .Title }}</h1>
{{ end }}
<section id="homepage-content">
{{ .Content }}
</section>
<!-- $pages -->
{{ $pages := union .RegularPages .Sections }}
<!---->{{ if .IsHome }} {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ end }}
<!-- Articles -->
<section id="homepage-articles">
<h2>Recent Posts</h2>
<ul>
{{ $paginator := .Paginate $pages }}
{{ range $index, $page := $paginator.Pages }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date | time.Format ":date_medium" }}</time></li>
{{ end }}
</ul>
</section>
<!-- Main Nav -->
{{ if gt $paginator.TotalPages 1 }}
<nav class="main-nav">
{{ if $paginator.HasPrev }}
<a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
{{ end }}<!---->
{{ if $paginator.HasNext }}
<a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
{{ end }}
</nav>
{{ end }}<!---->
{{ end }}

View file

@ -0,0 +1,34 @@
{{ define "main" }}
<!-- Main Title -->
{{ if .Title }}
<h1 class="main-title">{{ .Title }}</h1>
{{ end }}
<!-- $pages -->
{{ $pages := union .RegularPages .Sections }}
<!---->{{ if .IsHome }} {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ end }}
<!-- Articles -->
{{ $paginator := .Paginate $pages }} {{ range $index, $page := $paginator.Pages }}
<article class="post-entry">
<h2>{{ .Title }}</h2>
<time>{{ .Date | time.Format ":date_medium" }}</time>
<a href="{{ .Permalink }}"></a>
</article>
{{ end }}
<!-- Main Nav -->
{{ if gt $paginator.TotalPages 1 }}
<nav class="main-nav">
{{ if $paginator.HasPrev }}
<a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
{{ end }}<!---->
{{ if $paginator.HasNext }}
<a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
{{ end }}
</nav>
{{ end }}<!---->
{{ end }}

View file

@ -0,0 +1,49 @@
{{ define "main" }}
<article class="post-single">
<header class="post-title">
<p>
<time>{{ .Date | time.Format ":date_medium" }}</time>
{{ if or .Params.Author site.Author.name }}
<span>{{ .Params.Author | default site.Author.name }}</span>
{{ end }}
</p>
<h1>{{ .Title }}</h1>
</header>
<section class="post-content">{{ .Content }}</section>
<!-- Post Tags -->
{{ if .Params.tags }}
<footer class="post-tags">
{{ range .Params.tags }} {{ $href := print (absURL "tags/") (urlize .) }}
<a href="{{ $href }}">{{ . }}</a>
{{ end }}
</footer>
{{ end }}
<!-- Post Nav -->
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}<!---->
{{ if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="post-nav">
{{ with $pages.Next . }}
<a class="prev" href="{{ .Permalink }}"><span></span><span>{{ .Name }}</span></a>
{{ end }} {{ with $pages.Prev . }}
<a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span></span></a>
{{ 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 }}