Numerous improvements and bug fixes.

- Refactored themes to always load with just a single file. This avoids
  a round trip on each request.
- Locally load font when available on the system, then try to
  load the woff2 file, then fall back to regular woff.
- Update markup to use relative urls where it is safe. RSS feeds still
  use absolute URLs.
- Only set og:image:(height/width) when using the standard color icon.
- Fixed styles on the pagination buttons.
- Added ability to switch font to Source Code Pro (useSourceCodePro).
- Added yellow theme.
- Added grey theme.
- Bold and remove underline for active page in header.
- Removed markdownify on summary.
- Only display date if present.
This commit is contained in:
quest
2022-09-10 12:35:00 -10:00
parent 1610962731
commit 26ad260858
102 changed files with 306 additions and 142 deletions

View File

@@ -3,7 +3,7 @@
<h1 class="post-title">404 — {{ $.Site.Params.missingContentMessage | default "Page not found..." }}</h1>
<div class="post-content">
<a href="{{ "/" | absURL }}">{{ $.Site.Params.missingBackButtonLabel | default "Back to home page" }}&nbsp;</a>
<a href="{{ "/" | relURL }}">{{ $.Site.Params.missingBackButtonLabel | default "Back to home page" }}&nbsp;</a>
</div>
</div>

View File

@@ -17,12 +17,14 @@
{{ range $paginator.Pages }}
<div class="post on-list">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</h1>
<div class="post-meta">
{{ with .Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ .Format "2006-01-02" }}
</span>
{{ end }}
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>
{{ end }}
@@ -31,7 +33,7 @@
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
#<a href="{{ (urlize (printf "tags/%s/" . )) | relLangURL }}">
{{- . -}}
</a>&nbsp;
{{ end }}

View File

@@ -8,12 +8,14 @@
{{ range .Paginator.Pages }}
<div class="post on-list">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</h1>
<div class="post-meta">
{{ with .Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }}
{{ .Format "2006-01-02" }}
</span>
{{ end }}
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>
{{ end }}
@@ -22,7 +24,7 @@
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
#<a href="{{ (urlize (printf "tags/%s/" . )) | relLangURL }}">
{{- . -}}
</a>&nbsp;
{{ end }}
@@ -38,7 +40,7 @@
{{ else if .Description }}
{{ .Description | markdownify }}
{{ else }}
{{ .Summary | markdownify }}
{{ .Summary }}
{{ end }}
</div>

View File

@@ -1,7 +1,7 @@
{{ define "main" }}
<div class="post">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a></h1>
<div class="post-meta">
{{ if .Params.Date }}
<span class="post-date">
@@ -22,7 +22,7 @@
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>&nbsp;
#<a href="{{ (urlize (printf "tags/%s/" .)) | relLangURL }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}

View File

@@ -8,7 +8,7 @@
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a class="terms-title" href="{{ .Permalink }}">{{ .Name }} ({{ $count }})</a>
<a class="terms-title" href="{{ .RelPermalink }}">{{ .Name }} ({{ $count }})</a>
</li>
{{ end }}
{{ end }}

View File

@@ -5,7 +5,7 @@
{{- if .Resources.GetMatch .Params.Cover }}
{{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}}
{{- else -}}
{{- $cover = absURL .Params.Cover -}}
{{- $cover = relURL .Params.Cover -}}
{{- end -}}
{{- else if $.Site.Params.AutoCover -}}
{{- if (not .Params.Cover) -}}

View File

@@ -12,11 +12,11 @@
</div>
</footer>
<script src="{{ "assets/main.js" | absURL }}"></script>
<script src="{{ "assets/prism.js" | absURL }}"></script>
<script defer src="{{ "assets/main.js" | relURL }}"></script>
<script defer src="{{ "assets/prism.js" | relURL }}"></script>
{{ if $.Site.Params.showLanguageSelector }}
<script src="{{ "assets/languageSelector.js" | absURL }}"></script>
<script src="{{ "assets/languageSelector.js" | relURL }}"></script>
{{ end }}
<!-- Extended footer section-->

View File

@@ -8,24 +8,32 @@
{{ template "_internal/google_analytics.html" . }}
<!-- Theme CSS -->
<link rel="stylesheet" href="{{ "assets/style.css" | absURL }}">
{{ $scp := "" }}
{{ if (isset $.Site.Params "usesourcecodepro") }}
{{ if $.Site.Params.useSourceCodePro }}
{{ $scp = "-scp" }}
{{ end }}
{{ end }}
{{ if (isset .Params "color") }}
<link rel="stylesheet" href="{{ (printf "assets/%s.css" .Params.color) | absURL }}">
<link rel="stylesheet" href="{{ (printf "assets/%s%s.css" .Params.color $scp) | relURL }}">
{{ else if and (ne $.Site.Params.ThemeColor "orange") (ne $.Site.Params.ThemeColor "color" "") }}
<link rel="stylesheet" href="{{ (printf "assets/%s.css" $.Site.Params.ThemeColor) | absURL }}">
<link rel="stylesheet" href="{{ (printf "assets/%s%s.css" $.Site.Params.ThemeColor $scp) | relURL }}">
{{ else }}
<link rel="stylesheet" href="{{ (printf "assets/orange%s.css" $scp) | relURL }}">
{{ end }}
<!-- Custom CSS to override theme properties (/static/style.css) -->
{{ if (fileExists "static/style.css") -}}
<link rel="stylesheet" href="{{ "style.css" | absURL }}">
<link rel="stylesheet" href="{{ "style.css" | relURL }}">
{{- end }}
<!-- Icons -->
<link rel="apple-touch-icon" href="{{ "img/apple-touch-icon-192x192.png" | absURL }}">
<link rel="apple-touch-icon" href="{{ "img/apple-touch-icon-192x192.png" | relURL }}">
{{ if isset $.Site.Params "favicon" }}
<link rel="shortcut icon" href="{{ $.Site.Params.favicon | absURL }}">
<link rel="shortcut icon" href="{{ $.Site.Params.favicon | relURL }}">
{{ else }}
<link rel="shortcut icon" href="{{ printf "img/favicon/%s.png" ($.Site.Params.ThemeColor | default "orange") | absURL }}">
<link rel="shortcut icon" href="{{ printf "img/favicon/%s.png" ($.Site.Params.ThemeColor | default "orange") | relURL }}">
{{ end }}
<!-- Twitter Card -->
@@ -51,10 +59,10 @@
<meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}">
{{ else }}
<meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}">
<meta property="og:image:width" content="2048">
<meta property="og:image:height" content="1024">
{{ end }}
{{ end }}
<meta property="og:image:width" content="2048">
<meta property="og:image:height" content="1024">
{{ range .Params.categories }}
<meta property="article:section" content="{{ . }}" />
{{ end }}

View File

@@ -1,9 +1,12 @@
<nav class="menu">
<ul class="menu__inner menu__inner--desktop">
{{ $currentPage := . }}
{{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }}
{{ range first $.Site.Params.showMenuItems $.Site.Menus.main }}
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url := $currentPage.RelPermalink | relLangURL }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
<li><a{{ if eq $menu_item_url $page_url }} class="active"{{ end }} href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }}
@@ -13,7 +16,9 @@
<ul class="menu__sub-inner-more hidden">
{{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url := $currentPage.RelPermalink | relLangURL }}
<li><a{{ if eq $menu_item_url $page_url }} class="active"{{ end }} href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
</ul>
@@ -21,8 +26,10 @@
{{ end }}
{{ else }}
{{ range $.Site.Menus.main }}
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url := $currentPage.RelPermalink | relLangURL }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
<li><a{{ if eq $menu_item_url $page_url }} class="active"{{ end }} href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
@@ -35,7 +42,7 @@
</ul>
<ul class="language-selector__more hidden">
{{ range $.Site.Home.AllTranslations }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
<li><a{{ if eq .Language $.Language }} class="active"{{ end }} href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
</ul>
@@ -44,15 +51,17 @@
<ul class="menu__inner menu__inner--mobile">
{{ range $.Site.Menus.main }}
{{ $menu_item_url := .URL | relLangURL }}
{{ $page_url := $currentPage.RelPermalink | relLangURL }}
{{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
<li><a{{ if eq $menu_item_url $page_url }} class="active"{{ end }} href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}
<hr />
{{ range $.Site.Home.AllTranslations }}
<li>
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
<a{{ if eq .Language $.Language }} class="active"{{ end }} href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a>
</li>
{{ end }}
{{ end }}

View File

@@ -6,20 +6,16 @@
</div>
<div class="pagination__buttons">
{{ if .NextInSection }}
<span class="button previous">
<a href="{{ .NextInSection.Permalink }}">
<span class="button__icon"></span>
<span class="button__text">{{ .NextInSection.Title }}</span>
</a>
</span>
<a class="button previous" href="{{ .NextInSection.RelPermalink }}">
<span class="button__icon"></span>
<span class="button__text">{{ .NextInSection.Title }}</span>
</a>
{{ end }}
{{ if .PrevInSection }}
<span class="button next">
<a href="{{ .PrevInSection.Permalink }}">
<span class="button__text">{{ .PrevInSection.Title }}</span>
<span class="button__icon"></span>
</a>
</span>
<a class="button next" href="{{ .PrevInSection.RelPermalink }}">
<span class="button__text">{{ .PrevInSection.Title }}</span>
<span class="button__icon"></span>
</a>
{{ end }}
</div>
</div>

View File

@@ -11,5 +11,5 @@
<pre {{ if .Get "language" }}class="language-{{ .Get "language" }}" {{ end }}><code>{{ .Inner | string }}</code></pre>
</div>
{{ else }}
{{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.Permalink }}
{{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.RelPermalink }}
{{ end }}