aboutsummaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/_markup/render-codeblock.html6
-rw-r--r--layouts/_default/baseof.html17
-rw-r--r--layouts/_default/list.html32
-rw-r--r--layouts/_default/rss.xml72
-rw-r--r--layouts/_default/single.html24
5 files changed, 122 insertions, 29 deletions
diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html
new file mode 100644
index 0000000..6e1a075
--- /dev/null
+++ b/layouts/_default/_markup/render-codeblock.html
@@ -0,0 +1,6 @@
+<!-- https://github.com/jmooring/hugo-testing/blob/hugo-forum-topic-40998/layouts/_default/_markup/render-codeblock-katex.html -->
+{{ .Page.Store.Set "hasCodeBlock" true }}
+
+<!-- https://www.veriphor.com/articles/code-block-render-hooks/ -->
+{{ $result := transform.HighlightCodeBlock . }}
+{{ $result.Wrapped }} \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 6bce2dc..475d6f9 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -11,12 +11,23 @@
{{- partial "seo_tags.html" . -}}
<meta name="referrer" content="no-referrer-when-downgrade" />
+ {{ $style := resources.Get "style.css" | minify }}
+ <link href="{{ $style.RelPermalink }}" rel="stylesheet">
+
+ {{ if (.Page.Store.Get "hasCodeBlock") }}
+ {{ $syntax := resources.Get "syntax.css" | minify }}
+ <link href="{{ $syntax.RelPermalink }}" rel="stylesheet">
+ {{ end }}
+
+ {{ with .Params.style }}
+ {{ $extra := resources.Get . | minify }}
+ <link href="{{ $extra.RelPermalink }}" rel="stylesheet">
+ {{ end }}
+
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
- {{- partial "style.html" . -}}
-
<!-- A partial to be overwritten by the user.
Simply place a custom_head.html into
your local /layouts/partials-directory -->
@@ -27,7 +38,7 @@
<header>
{{- partial "header.html" . -}}
</header>
- <main>
+ <main id="main-content">
{{- block "main" . }}{{- end }}
</main>
<footer>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 90cbee5..354bc9c 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,10 +1,7 @@
{{ define "main" }}
<content>
{{ if .Data.Singular }}
- <h3 style="margin-bottom:0">Filtering for "{{ .Title }}"</h3>
- <small>
- <a href="{{ "blog" | relURL }}">Remove filter</a>
- </small>
+ <h3 class="blog-filter">{{ i18n "filtering-for" }} "{{ .Title }}"</h3>
{{ end }}
<ul class="blog-posts">
{{ range .Pages }}
@@ -12,27 +9,28 @@
<span>
<i>
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
- {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }}
+ {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
</time>
</i>
</span>
- <a href="{{ .Permalink }}">{{ .Title }}</a>
+ {{ if .Params.link }}
+ <a href="{{ .Params.link }}" target="_blank">{{ .Title }} ↪</a>
+ {{ else }}
+ <a href="{{ .Permalink }}">{{ .Title }}</a>
+ {{ end }}
</li>
{{ else }}
<li>
- No posts yet
+ {{ i18n "no-posts" }}
</li>
{{ end }}
</ul>
- {{ if .Data.Singular }}
- {{else}}
- <small>
- <div>
- {{ range .Site.Taxonomies.tags }}
- <a href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a>&nbsp;
- {{ end }}
- </div>
- </small>
- {{ end }}
+ {{ if not .Data.Singular }}
+ <div>
+ {{ range .Site.Taxonomies.tags }}
+ <a class="blog-tags" href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a>&nbsp;&nbsp;
+ {{ end }}
+ </div>
+ {{ end }}
</content>
{{ end }}
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
new file mode 100644
index 0000000..70d1193
--- /dev/null
+++ b/layouts/_default/rss.xml
@@ -0,0 +1,72 @@
+{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
+{{- $authorEmail := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .email }}
+ {{- $authorEmail = . }}
+ {{- end }}
+ {{- end }}
+{{- else }}
+ {{- with site.Author.email }}
+ {{- $authorEmail = . }}
+ {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
+ {{- end }}
+{{- end }}
+
+{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
+{{- $authorName := "" }}
+{{- with site.Params.author }}
+ {{- if reflect.IsMap . }}
+ {{- with .name }}
+ {{- $authorName = . }}
+ {{- end }}
+ {{- else }}
+ {{- $authorName = . }}
+ {{- end }}
+{{- else }}
+ {{- with site.Author.name }}
+ {{- $authorName = . }}
+ {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
+ {{- end }}
+{{- end }}
+
+{{- $pctx := . }}
+{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
+{{- $pages := slice }}
+{{- if or $.IsHome $.IsSection }}
+{{- $pages = $pctx.RegularPages }}
+{{- else }}
+{{- $pages = $pctx.Pages }}
+{{- end }}
+{{- $limit := .Site.Config.Services.RSS.Limit }}
+{{- if ge $limit 1 }}
+{{- $pages = $pages | first $limit }}
+{{- end }}
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+ <channel>
+ <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
+ <link>{{ .Permalink }}</link>
+ <description>Recent content {{ if not .IsHome }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
+ <generator>Hugo -- gohugo.io</generator>
+ <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
+ <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
+ <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
+ <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
+ <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
+ {{- with .OutputFormats.Get "RSS" }}
+ {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
+ {{- end }}
+ {{- range $pages }}
+ <item>
+ <title>{{ .Title }}</title>
+ <link>{{ .Permalink }}</link>
+ <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+ {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
+ <guid>{{ .Permalink }}</guid>
+ <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
+ <content:encoded>{{ `<![CDATA[` | safeHTML }}{{ .Content | safeHTML }}{{ `]]>` | safeHTML }}</content:encoded>
+ </item>
+ {{- end }}
+ </channel>
+</rss>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 7d57351..6f6c699 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,20 +1,26 @@
{{ define "main" }}
-{{ if eq .Type "blog" }}{{ if not .Params.menu }}
+{{ if not .Params.menu }}
<h1>{{ .Title }}</h1>
-<p>
- <i>
- <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
- {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }}
- </time>
- </i>
+<p class="byline">
+ <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
+ {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
+ </time>
+ {{ with .Params.author }}· {{.}}{{ end }}
</p>
-{{ end }}{{ end }}
+{{ end }}
<content>
{{ .Content }}
</content>
<p>
{{ range (.GetTerms "tags") }}
- <a href="{{ .Permalink }}">#{{ .LinkTitle }}</a>
+ <a class="blog-tags" href="{{ .Permalink }}">#{{ .LinkTitle }}</a>&nbsp;&nbsp;
{{ end }}
</p>
+{{ with .Site.Params.author.email }}
+ <p>
+ <a href='mailto:{{ . }}?subject={{ i18n "email-subject" }}"{{ default $.Site.Title $.Page.Title }}"'>
+ {{ i18n "email-reply" }} ↪
+ </a>
+ </p>
+{{ end }}
{{ end }}