mirror of
https://github.com/ItsDrike/itsdrike.com.git
synced 2025-06-29 16:10:43 +00:00
Format HTML everywhere
This commit is contained in:
parent
8955235db0
commit
75a45a192b
18 changed files with 174 additions and 189 deletions
|
@ -5,21 +5,23 @@
|
|||
{{ end }}
|
||||
|
||||
{{ if not .Parent.IsHome }}
|
||||
{{ if gt .ReadingTime 2 }}
|
||||
<span class="pr-2" title='Reading time'>
|
||||
<i class="far fa-clock pr-1 content-detail"></i> {{ .ReadingTime }} minutes
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="pr-2" title="Word count">
|
||||
{{ if gt .ReadingTime 2 }}
|
||||
<span class="pr-2" title="Reading time">
|
||||
<i class="far fa-clock pr-1 content-detail"></i> {{ .ReadingTime }} minutes
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="pr-2" title="Word count">
|
||||
<i class="far fa-file-alt pr-1 content-detail"></i> {{ .WordCount }} words
|
||||
</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.tags }}
|
||||
<a href="{{ ref . " /tags" }}" class="no-color-change mr-1">
|
||||
<i class="fas fa-tags small content-detail"></i>
|
||||
</a>
|
||||
{{ range $i, $e := .Params.tags }}
|
||||
<span class="pr-2" title="Tags">
|
||||
<a href="{{ ref . " /tags" }}" class="no-color-change mr-1">
|
||||
<i class="fas fa-tags small content-detail"></i>
|
||||
</a>
|
||||
{{ range $i, $e := .Params.tags }}
|
||||
<a href="/tags/{{ urlize . }}" class="mr-1">#{{ . }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
<h1 class="display-4">{{ .Title }}</h1>
|
||||
{{ if .Params.subtitle }}
|
||||
<h5 class="my-3">{{ markdownify .Params.subtitle | emojify }}</h5>
|
||||
<h5 class="my-3">{{ markdownify .Params.subtitle | emojify }}</h5>
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsPage }}
|
||||
<p>{{ partial "content-details.html" . }}</p>
|
||||
<p>{{ partial "content-details.html" . }}</p>
|
||||
|
||||
<!-- When directly viewing the article, if available, we also include revision date-->
|
||||
{{ if and (not .Lastmod.IsZero) (not (.Lastmod.Equal .Date)) }}
|
||||
<span class="pr-2" title='{{ .Lastmod.Format "January 2 2006" }}'>
|
||||
<i class="pr-1 content-detail">Article revised in: {{ .Lastmod.Format "January 2 2006" }}</i>
|
||||
</span>
|
||||
{{ end }}
|
||||
<!-- When directly viewing the article, if available, we also include revision date-->
|
||||
{{ if and (not .Lastmod.IsZero) (not (.Lastmod.Equal .Date)) }}
|
||||
<span class="pr-2" title='{{ .Lastmod.Format "January 2 2006" }}'>
|
||||
<i class="pr-1 content-detail">Article revised in: {{ .Lastmod.Format "January 2 2006" }}</i>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Content }}
|
||||
<hr>
|
||||
<hr>
|
||||
|
||||
<div class="content mt-3">
|
||||
<div class="content mt-3">
|
||||
{{ if .TableOfContents }}
|
||||
<!-- Get the amount of headers using regex -->
|
||||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
|
||||
<!-- We only need to show a table of contents if we have over 4 headers -->
|
||||
{{ if ge (len $headers) 4 }}
|
||||
<!-- Get the amount of headers using regex -->
|
||||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
|
||||
<!-- We only need to show a table of contents if we have over 4 headers -->
|
||||
{{ if ge (len $headers) 4 }}
|
||||
<div class="float-lg-end ml-lg-3 mb-3 p-3">
|
||||
{{ .TableOfContents }}
|
||||
{{ .TableOfContents }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ .Content }}
|
||||
|
||||
|
||||
<div id="sources">
|
||||
{{ if .Params.Sources }}
|
||||
<h2>Sources</h2>
|
||||
<ul>
|
||||
{{ range $i, $e := .Params.Sources }}
|
||||
<li>{{ markdownify $e }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ .Content }}
|
||||
|
||||
|
||||
<div id="sources">
|
||||
{{ if .Params.Sources }}
|
||||
<h2>Sources</h2>
|
||||
<ul>
|
||||
{{ range $i, $e := .Params.Sources }}
|
||||
<li>{{ markdownify $e }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{ $sizes := slice 16 32 64 100 200 }}
|
||||
|
||||
{{ range $sizes }}
|
||||
{{ $sizes := printf "%dx%d" . . }}
|
||||
<link rel="icon" type="image/png" sizes="{{ $sizes }}"
|
||||
{{ $sizes := printf "%dx%d" . . }}
|
||||
<link rel="icon" type="image/png" sizes="{{ $sizes }}"
|
||||
href='{{ ((resources.Get $image | fingerprint).Resize $sizes).RelPermalink }}'>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
<footer class="p-5">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<p>© {{ now.Year }} <a href='{{ ref . "contact" }}'>{{ .Site.Title }}</a>.</p>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<a href='{{ ref . "privacy-policy" }}'>Privacy policy</a>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h3 class="text-right">
|
||||
{{ range .Site.Data.social.footer_accounts }}
|
||||
{{ $account := index $.Site.Data.social.accounts . }}
|
||||
<a href="{{ $account.link }}"><i class="mx-1 {{ $account.icon }}" aria-hidden="true" title="{{ $account.name }}"></i></a>
|
||||
{{ end }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
<p>© {{ now.Year }} <a href='{{ ref . "contact" }}'>{{ .Site.Title }}</a>.</p>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<a href='{{ ref . "privacy-policy" }}'>Privacy policy</a>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h3 class="text-right">
|
||||
{{ range .Site.Data.social.footer_accounts }}
|
||||
{{ $account := index $.Site.Data.social.accounts . }}
|
||||
<a href="{{ $account.link }}"><i class="mx-1 {{ $account.icon }}" aria-hidden="true"
|
||||
title="{{ $account.name }}"></i></a>
|
||||
{{ end }}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{ if .Params.image }}
|
||||
{{ .Scratch.Set "image" .Params.image }}
|
||||
{{ if hasPrefix .Params.image "resource:" }}
|
||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||
{{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
<img class="mb-3 header-image" src='{{ .Scratch.Get "image" }}' />
|
||||
{{ .Scratch.Set "image" .Params.image }}
|
||||
{{ if hasPrefix .Params.image "resource:" }}
|
||||
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
||||
{{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
<img class="mb-3 header-image" src='{{ .Scratch.Get "image" }}' />
|
||||
{{ end }}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<nav class="navbar navbar-expand-sm navbar-dark">
|
||||
<!-- Navbar home -->
|
||||
<a class="navbar-brand" href="{{ ref . "/" }}">
|
||||
<code>/home/{{ lower .Site.Title }}</code>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<!-- Navbar home -->
|
||||
<a class="navbar-brand" href="{{ ref . " /" }}">
|
||||
<code>/home/{{ lower .Site.Title }}</code>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<!-- Left side of the Navbar -->
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<!-- Navbar pages -->
|
||||
{{ $home := .Site.GetPage "home" }}
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<!-- Left side of the Navbar -->
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<!-- Navbar pages -->
|
||||
{{ $home := .Site.GetPage "home" }}
|
||||
|
||||
{{ $pages := where .Site.RegularPages.ByTitle "Section" "" }}
|
||||
{{ $nav_pages := union $pages .Site.Sections }}
|
||||
{{ $pages := where .Site.RegularPages.ByTitle "Section" "" }}
|
||||
{{ $nav_pages := union $pages .Site.Sections }}
|
||||
|
||||
{{ $nav_pages = where $nav_pages "Params.hidden_from_navbar" "!=" true }}
|
||||
{{ $nav_pages = where $nav_pages "Params.hidden_from_navbar" "!=" true }}
|
||||
|
||||
{{ range sort $nav_pages "LinkTitle" }}
|
||||
<li class="nav-item">
|
||||
<a href="{{ .RelPermalink }}" class="nav-link">
|
||||
<code>~/{{ urlize .LinkTitle }}</code>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ range sort $nav_pages "LinkTitle" }}
|
||||
<li class="nav-item">
|
||||
<a href="{{ .RelPermalink }}" class="nav-link">
|
||||
<code>~/{{ urlize .LinkTitle }}</code>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{ $script := resources.Get . }}
|
||||
|
||||
{{ if in . "min" }}
|
||||
{{ $script = $script | minify | fingerprint }}
|
||||
{{ $script = $script | minify | fingerprint }}
|
||||
{{ else }}
|
||||
{{ $script = $script | js.Build (dict "minify" true) | fingerprint }}
|
||||
{{ $script = $script | js.Build (dict "minify" true) | fingerprint }}
|
||||
{{ end }}
|
||||
|
||||
<script type="text/javascript" src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{ $script := resources.Get . }}
|
||||
|
||||
{{ if in . "min" }}
|
||||
{{ $script = $script | minify | fingerprint }}
|
||||
{{ $script = $script | minify | fingerprint }}
|
||||
{{ else }}
|
||||
{{ $script = $script | js.Build (dict "minify" true) | fingerprint }}
|
||||
{{ $script = $script | js.Build (dict "minify" true) | fingerprint }}
|
||||
{{ end }}
|
||||
|
||||
<script type="text/javascript" async src="{{ $script.RelPermalink }}" integrity="{{ $script.Data.Integrity }}"></script>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ if .Content }}
|
||||
{{ .Summary | chomp }}{{ if .Truncated }}…{{ end }}
|
||||
{{ .Summary | chomp }}{{ if .Truncated }}…{{ end }}
|
||||
{{ else if .Params.subtitle }}
|
||||
{{ .Params.subtitle | markdownify | emojify }}
|
||||
{{ .Params.subtitle | markdownify | emojify }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ .Title }} ::
|
||||
|
||||
{{ if .Parent }}{{ if not .Parent.IsHome }}
|
||||
{{ partial "title-item.html" .Parent }}
|
||||
{{ partial "title-item.html" .Parent }}
|
||||
{{ end }}{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue