commit fa677233f88cadb39c909b01c778ac7a700d0bba
parent d4173464813d71c57632bc9a4504fcaec2021478
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date: Sun, 23 Jul 2023 15:37:49 -0700
Local theme and configuration changes
Personalizing the site template finally, and added some local partials
(that I wouldn't expect to add to the upstream theme). I also took a
first pass at writing a home page. Note that katex support requires a
change to the theme which I haven't pushed upstream yet (which is why
the submodule now points to my fork of the theme).
Diffstat:
9 files changed, 106 insertions(+), 9 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "themes/readable"]
path = themes/readable
- url = https://github.com/cjtheham/hugo-theme-readable
-\ No newline at end of file
+ url = https://git.eamoncaddigan.net/hugo-theme-readable.git
diff --git a/config/_default/config.yml b/config/_default/config.yml
@@ -1,14 +1,17 @@
theme: 'readable'
-title: 'Your Title'
+title: 'Potentially Useful'
languages:
en:
languageName: English
menu:
main:
- - name: Blog
+ - name: All Posts
url: /posts
weight: 10
+ - name: Categories
+ url: /categories
+ weight: 2
- name: Home
url: /
weight: 1
@@ -18,3 +21,13 @@ frontmatter:
- lastmod
- date
- publishDate
+
+ignoreFiles:
+ - "\\.Rmd$"
+
+outputs:
+ home:
+ - HTML
+ section:
+ - HTML
+ - RSS
diff --git a/config/_default/params.yml b/config/_default/params.yml
@@ -1,4 +1,4 @@
-author: 'Your Name'
-mastodon: 'your mastodon link here'
-subtitle: 'Your Subtitle'
+author: 'Eamon Caddigan'
+mastodon: 'https://social.coop/@eamon'
+subtitle: 'Writing boring posts is okay'
navbar_style: classy
diff --git a/content/_index.md b/content/_index.md
@@ -2,4 +2,16 @@
title: ''
---
-Your Content Here!
-\ No newline at end of file
+Welcome to my personal site, the primary place where I put things when I
+want to put them on the internet. You can browse the list of categories or
+the complete list of posts using the menu above. I also maintain a [list of
+journal articles]({{< ref "pubs/index.md" >}}) (and occasional preprints) to
+which I've contributed, and some of my [source code
+repositories](https://git.eamoncaddigan.net/) are available on a separate
+site.
+
+Most posts are listed under at least one of the following categories:
+
+* [Data Science](/categories/data-science)
+* [Programming](/categories/programming)
+* [Science](/categories/science)
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
@@ -0,0 +1,39 @@
+{{- $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">
+ <channel>
+ <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
+ <link>{{ .Permalink }}</link>
+ <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
+ <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
+ <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
+ <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
+ <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
+ <copyright>booooo {{.}}</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 .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
+ <guid>{{ .Permalink }}</guid>
+ <description>{{ .Content | html }}</description>
+ </item>
+ {{ end }}
+ </channel>
+</rss>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
@@ -0,0 +1,2 @@
+<p>© {{ .Lastmod.Format "2006" }} {{ $.Site.Params.author }}, <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></p>
+<a rel="me" href="{{ $.Site.Params.Mastodon }}" target="blank">Mastodon</a> | <a href="/about/">About</a> | <a href="/posts/index.xml">RSS Feed</a></p>
diff --git a/layouts/partials/hook_head_end.html b/layouts/partials/hook_head_end.html
@@ -0,0 +1 @@
+{{ if .Params.katex}}{{ partial "katex.html" . }}{{ end }}
diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html
@@ -0,0 +1,6 @@
+<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
+<!-- The loading of KaTeX is deferred to speed up page rendering -->
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
+<!-- To automatically render math in text elements, include the auto-render extension: -->
+<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
+ onload="renderMathInElement(document.body);"></script>
diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html
@@ -0,0 +1,26 @@
+{{ $dateTime := .PublishDate.Format "2006-01-02" }}
+{{ $lastmodTime := .Lastmod.Format "2006-01-02" }}
+{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
+<i data-feather="calendar"></i>
+{{ if .PublishDate }}
+{{ if and (ne $lastmodTime $dateTime) (gt .Lastmod .Date) }}
+ <time datetime="{{ $lastmodTime }}">{{ .Lastmod.Format $dateFormat }}</time>
+ (first posted <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>)
+{{ else }}
+ <time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
+{{ end }}
+{{ end }}
+{{ with .Params.categories }}
+<i data-feather="tag"></i>in:
+{{ range . }}
+{{ $href := print "/categories/" (urlize .) }}
+<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
+{{ end }}
+{{ end }}
+{{ with .Params.tags }}
+tagged:
+{{ range . }}
+{{ $href := print "/tags/" (urlize .) }}
+<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
+{{ end }}
+{{ end }}