mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2025-10-09 10:11:14 +00:00
Refactored template code
This commit is contained in:
parent
b28e531f9f
commit
c3e09727a6
20 changed files with 332 additions and 395 deletions
14
layouts/partials/date.html
Normal file
14
layouts/partials/date.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{ if not .Date.IsZero }}
|
||||
{{ $publishString := .Scratch.Get "beforeDateString" }}
|
||||
{{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}}
|
||||
{{ $pubdate := .Date.Format $singlePageDateFormat }}
|
||||
|
||||
<p class="date">{{ $publishString }}<time class="dt-published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z0700" }}'>{{ $pubdate }}</time></p>
|
||||
|
||||
{{- if and (not (.Scratch.Get "noDateUpdate")) .Lastmod }}
|
||||
{{- $lastmod := .Lastmod.Format $singlePageDateFormat }}
|
||||
{{- if ne $lastmod $pubdate }}
|
||||
<p class="date-updated">Updated on <time class='dt-updated' datetime='{{ .Lastmod.Format "2006-01-02T15:04:05Z0700" }}'>{{ $lastmod }}</time></p>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
8
layouts/partials/reading_time.html
Normal file
8
layouts/partials/reading_time.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!-- Reading Time -->
|
||||
{{ $readTime := mul (div (countwords .Content) 220.0) 60 }}
|
||||
{{ if gt $readTime 60 }}
|
||||
<p>
|
||||
Reading Time:
|
||||
{{ math.Ceil (div $readTime 60) }} minutes.
|
||||
</p>
|
||||
{{ end }}
|
16
layouts/partials/search.html
Normal file
16
layouts/partials/search.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!-- search box -->
|
||||
<div id="searchBox">
|
||||
<input type="text" id="searchBoxInput" placeholder="Search..." />
|
||||
<img id="searchBoxIcon" src="{{ .Site.BaseURL }}/img/search.png" />
|
||||
</div>
|
||||
<!-- search results -->
|
||||
<div id="searchResults"></div>
|
||||
|
||||
{{ $jquery := resources.Get "js/jquery-3.5.1.min.js" }}
|
||||
{{ $mark := resources.Get "js/jquery.mark.es6.min.js" }}
|
||||
{{ $lunr := resources.Get "js/lunr.js" }}
|
||||
{{ $search := resources.Get "js/search.js" }}
|
||||
<script src="{{ $jquery.Permalink }}"></script>
|
||||
<script src="{{ $mark.Permalink }}"></script>
|
||||
<script src="{{ $lunr.Permalink }}"></script>
|
||||
<script src="{{ $search.Permalink }}"></script>
|
8
layouts/partials/tags_list_all.html
Normal file
8
layouts/partials/tags_list_all.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!-- tags -->
|
||||
<div id="tags">
|
||||
<ul>
|
||||
{{ range .Site.Taxonomies.tags.ByCount }}
|
||||
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }} ({{ .Count }})</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
11
layouts/partials/tags_list_page.html
Normal file
11
layouts/partials/tags_list_page.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!-- List the tags that apply to this page -->
|
||||
<div id="tags">
|
||||
<ul>
|
||||
{{ range .Param "tags" }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" ($name | urlize)) }}
|
||||
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
11
layouts/partials/webmentions.html
Normal file
11
layouts/partials/webmentions.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!-- Webmentions -->
|
||||
<div id="webmentions"></div>
|
||||
<form method="post" action="https://webmention.io/brandonrozek.com/webmention">
|
||||
<p>Have you published a response to this? <label for="webmention-source">Let me know the <abbr title="Uniform Resource Locator">URL</abbr></label>:</p>
|
||||
<input type="url" name="source" id="webmention-source">
|
||||
<input type="hidden" name="target" value="{{ .Permalink }}">
|
||||
<button type="submit">Ping!</button>
|
||||
</form>
|
||||
</main>
|
||||
{{ $webmentionjs := resources.Get "js/webmention.min.js" }}
|
||||
<script src="{{ $webmentionjs.Permalink }}" async></script>
|
Loading…
Add table
Add a link
Reference in a new issue