Compare commits

...

13 Commits

Author SHA1 Message Date
6b178bebcb Add canonical URLs
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-05-06 18:57:05 -07:00
ea33963a77 Enable OpenGraph / Twitter data generation
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-05-06 18:54:31 -07:00
a5bb7577f3 Add default banner image
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-05-06 18:54:12 -07:00
676ea50de8 Switch to HTTPs for assets
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-05-06 18:53:36 -07:00
3b8d6c894a Tweaks to work with latest Hugo version
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-05-06 17:20:56 -07:00
cb73f4e7a5 Move custom_css into writing template only. 2026-04-19 00:36:18 -07:00
7d26aeff65 Make writing CSS precede per-page custom CSS.
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-04-19 00:26:06 -07:00
a70cc32441 Enable custom CSS and bring in writing layout from blog.
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-04-19 00:22:47 -07:00
3937ed4172 Do not unique-by-series when a flag is set
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-04-05 16:18:12 -07:00
5e84ea2a06 Make some fixes to broken visuals
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-04-05 16:02:09 -07:00
312d0d37c6 Fix CSS issue with tags
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-03-22 01:30:42 -05:00
5460d759b0 Add fallbacks for system fonts to reduce layout shift.
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-01-03 18:08:15 -08:00
54e942c85f Add 'needs LaTeX' meta for pages where LaTeX is needed for Bergamot
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2026-01-03 16:34:22 -08:00
17 changed files with 301 additions and 21 deletions

View File

@@ -43,3 +43,23 @@
@include font-raleway(400); @include font-raleway(400);
@include font-raleway(700); @include font-raleway(700);
@include font-stixgeneral(); @include font-stixgeneral();
/* Generated from chatgpt-adjust-fallback.py */
@font-face {
font-family: "Raleway Fallback";
src: local("Arial");
size-adjust: 100.09%;
ascent-override: 94.00%;
descent-override: 23.40%;
line-gap-override: 0.00%;
}
@font-face {
font-family: "Lora Fallback";
src: local("Times New Roman");
size-adjust: 111.79%;
ascent-override: 100.60%;
descent-override: 27.40%;
line-gap-override: 0.00%;
}

View File

@@ -67,12 +67,20 @@ p {
} }
} }
.button, input[type="submit"] { .tag-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 0.25rem;
justify-content: center;
}
.tag {
@include var(color, text-color); @include var(color, text-color);
padding: 0.5rem; padding: 0.5rem;
border: 1px solid $primary-color; border: 1px solid $primary-color;
transition: color 0.25s, background-color 0.25s; transition: color 0.25s, background-color 0.25s;
text-align: left; text-align: left;
display: block;
&:focus { &:focus {
outline: none; outline: none;

View File

@@ -9,8 +9,8 @@ $background-color-dark: #1b1d1f;
$standard-border-width: .075rem; $standard-border-width: .075rem;
$standard-border: $standard-border-width solid $border-color; $standard-border: $standard-border-width solid $border-color;
$font-heading: "Lora", serif; $font-heading: "Lora", "Lora Fallback", serif;
$font-body: "Raleway", serif; $font-body: "Raleway", "Raleway Fallback", sans-serif;
$font-code: "Inconsolata", monospace, "STIXGeneral"; $font-code: "Inconsolata", monospace, "STIXGeneral";
$warning-background-color: #ffee99; $warning-background-color: #ffee99;

115
banner.svg Normal file
View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="297mm"
height="210mm"
viewBox="0 0 297 210"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (ebf0e940, 2025-05-08)"
sodipodi:docname="banner.svg"
inkscape:export-filename="banner-source.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="0.75557496"
inkscape:cx="451.97368"
inkscape:cy="438.73873"
inkscape:window-width="1728"
inkscape:window-height="996"
inkscape:window-x="0"
inkscape:window-y="38"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:export-bgcolor="#ffffffff" />
<defs
id="defs1">
<rect
x="49.549049"
y="153.15161"
width="826.85009"
height="237.77854"
id="rect8" />
<rect
x="49.549049"
y="111.10999"
width="678.67182"
height="524.01873"
id="rect7" />
<rect
x="244.20348"
y="346.16049"
width="287.95187"
height="438.00638"
id="rect4" />
<rect
x="244.20348"
y="346.16049"
width="414.25137"
height="418.77991"
id="rect4-6" />
<rect
x="244.20348"
y="346.16049"
width="414.25137"
height="418.77991"
id="rect4-6-1" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:#36e281;fill-opacity:1;stroke:#36e281;stroke-width:4.33532;stroke-dasharray:none;stroke-opacity:1"
id="path3"
cy="91.614052"
cx="148.5"
r="36.96402" />
<path
id="path3-3-6"
style="fill:#ffffff;stroke:#36e281;stroke-width:4.33532;stroke-dasharray:none;stroke-opacity:1"
d="m 148.49869,128.57807 c -13.20597,0 -25.40879,-7.0453 -32.01177,-18.48201 -6.60299,-11.436707 -6.60299,-25.527312 0,-36.964017 6.60298,-11.436705 18.8058,-18.482007 32.01177,-18.482007"
sodipodi:nodetypes="cssc" />
<text
xml:space="preserve"
transform="matrix(-0.15711337,0,0,0.19685436,189.77821,-5.4885608)"
id="text4-3"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:253.455px;font-family:Helvetica;-inkscape-font-specification:'Helvetica Bold';text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect4-6);display:inline;fill:#36e281;fill-opacity:1;stroke:#36e281;stroke-width:1.37953;stroke-opacity:1"><tspan
x="244.20312"
y="584.4805"
id="tspan1">D</tspan></text>
<text
xml:space="preserve"
transform="matrix(0.15711337,0,0,0.19685436,107.21917,-5.5129228)"
id="text4-3-2"
style="font-size:253.455px;text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect4-6-1);display:inline;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.37953;stroke-opacity:1"><tspan
x="244.20312"
y="584.4805"
id="tspan3"><tspan
style="font-weight:bold;font-family:Helvetica;-inkscape-font-specification:'Helvetica Bold'"
id="tspan2">F</tspan></tspan></text>
<text
xml:space="preserve"
transform="matrix(0.19664896,0,0,0.19664896,73.930049,102.60811)"
id="text8"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:106.667px;font-family:Lora;-inkscape-font-specification:'Lora Bold';text-align:start;writing-mode:lr-tb;direction:ltr;white-space:pre;shape-inside:url(#rect8);display:inline;fill:#1a1a1a;fill-opacity:1;stroke:none;stroke-width:22.046"><tspan
x="49.548828"
y="250.31931"
id="tspan4">Daniel's Blog</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,90 @@
"""
Generate @font-face settings to help make the fallback font look similar
to the non-fallback font.
Genererated by ChatGTP 5.2-instant. Not human-modified.
"""
from fontTools.ttLib import TTFont
USE_TYPO_METRICS = 1 << 7
def get_metrics(path):
font = TTFont(path)
head = font["head"]
os2 = font["OS/2"]
hhea = font["hhea"]
use_typo = bool(os2.fsSelection & USE_TYPO_METRICS)
if use_typo:
asc = os2.sTypoAscender
desc = os2.sTypoDescender
gap = os2.sTypoLineGap
source = "OS/2.sTypo*"
else:
asc = hhea.ascent
desc = -hhea.descent
gap = hhea.lineGap
source = "hhea.*"
# x-height ALWAYS comes from OS/2
if not hasattr(os2, "sxHeight") or os2.sxHeight <= 0:
raise ValueError(f"{path} has no usable sxHeight")
x_height = os2.sxHeight
print("Source", path, source)
return {
"unitsPerEm": head.unitsPerEm,
"ascender": asc,
"descender": desc,
"lineGap": gap,
"xHeight": x_height,
}
def compute_overrides(target, fallback):
# size-adjust: match x-height
size_adjust = (
(target["xHeight"] / target["unitsPerEm"]) /
(fallback["xHeight"] / fallback["unitsPerEm"])
)
# overrides: force target vertical metrics
ascent_override = target["ascender"] / target["unitsPerEm"]
descent_override = abs(target["descender"]) / target["unitsPerEm"]
line_gap_override = target["lineGap"] / target["unitsPerEm"]
return {
"size_adjust": size_adjust * 100,
"ascent_override": ascent_override * 100,
"descent_override": descent_override * 100,
"line_gap_override": line_gap_override * 100,
}
def emit_css(family_name, local_name, values):
return f"""
@font-face {{
font-family: "{family_name}";
src: local("{local_name}");
size-adjust: {values['size_adjust']:.2f}%;
ascent-override: {values['ascent_override']:.2f}%;
descent-override: {values['descent_override']:.2f}%;
line-gap-override: {values['line_gap_override']:.2f}%;
}}
""".strip()
# ---- Example usage ----
target = get_metrics("static/fonts/gen/Lora-Regular.woff2")
fallback = get_metrics("/System/Library/Fonts/Supplemental/Times New Roman.ttf")
values = compute_overrides(target, fallback)
print(emit_css(
family_name="Lora Fallback",
local_name="Times New Roman",
values=values,
))

View File

@@ -1,7 +1,8 @@
[params] [params]
katexCssUrl = "//static.danilafe.com/katex/katex.min.css" katexCssUrl = "https://static.danilafe.com/katex/katex.min.css"
katexJsUrl = "//static.danilafe.com/katex/katex.min.js" katexJsUrl = "https://static.danilafe.com/katex/katex.min.js"
normalizeCssUrl = "//static.danilafe.com/normalize/normalize.css" normalizeCssUrl = "https://static.danilafe.com/normalize/normalize.css"
visNetworkJsUrl = "//static.danilafe.com/vis-network/vis-network.min.js" visNetworkJsUrl = "https://static.danilafe.com/vis-network/vis-network.min.js"
bergamotJsUrl = "//static.danilafe.com/bergamot/bergamot.js" bergamotJsUrl = "https://static.danilafe.com/bergamot/bergamot.js"
bergamotObjectLanguageJsUrl = "//static.danilafe.com/bergamot/objectlang.js" bergamotObjectLanguageJsUrl = "https://static.danilafe.com/bergamot/objectlang.js"
images = ["banner.png"]

View File

@@ -1,6 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}"> <html lang="{{ .Site.Language.Lang }}">
<head>
{{- partial "head.html" . -}} {{- partial "head.html" . -}}
</head>
<body> <body>
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
<div class="container"><hr class="header-divider"></div> <div class="container"><hr class="header-divider"></div>

View File

@@ -1,9 +1,9 @@
{{ define "main" }} {{ define "main" }}
<h2>{{ .Title }}</h2> <h2>{{ .Title }}</h2>
<div class="post-subscript"> <div class="post-subscript">
<p> <p class="tag-list">
{{- range (.GetTerms "tags") -}} {{- range (.GetTerms "tags") -}}
<a class="button" href="{{ .Permalink }}">{{ .Title }}</a> <a class="tag" href="{{ .Permalink }}">{{ .Title }}</a>
{{ end -}} {{ end -}}
</p> </p>
<p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p> <p>{{ i18n "postedOn" (.Date.Format "January 2, 2006") }}.</p>

View File

@@ -1,4 +1,3 @@
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#1dc868"> <meta name="theme-color" content="#1dc868">
@@ -50,6 +49,11 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ partial "opengraph.html" . }}
{{ partial "twitter_cards.html" . }}
<link rel="canonical" href="{{ .Permalink }}">
{{ if hugo.IsServer }} {{ if hugo.IsServer }}
<!-- KaTeX auto-rendering for when we don't have a post-processing step. --> <!-- KaTeX auto-rendering for when we don't have a post-processing step. -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.js" integrity="sha384-X/XCfMm41VSsqRNQgDerQczD69XqmjOOOwYQvr/uuC+j4OPoNhVgjdGFwhvN02Ja" crossorigin="anonymous"></script>
@@ -58,6 +62,8 @@
{{ end }} {{ end }}
{{ if .Params.bergamot }} {{ if .Params.bergamot }}
<!-- Ensure later scripts keep the KaTeX CSS even if the page has no LaTeX !-->
<meta name="needs-latex">
<!-- Code to support the Bergamot JS widget --> <!-- Code to support the Bergamot JS widget -->
<script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script> <script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
{{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify }} {{ $katexComponentJs := resources.Get "js/katex-component.js" | resources.Minify }}
@@ -96,4 +102,3 @@
{{ end }} {{ end }}
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
</head>

View File

@@ -18,10 +18,12 @@
{{- if .linkSeries -}} {{- if .linkSeries -}}
{{- $term := index (.page.GetTerms "series") 0 -}} {{- $term := index (.page.GetTerms "series") 0 -}}
{{- with $term -}} {{- with $term -}}
{{- if (not ($term.Param "donotunique")) -}}
<div class="series-link"> <div class="series-link">
{{- partial "icon.html" "corner-down-right" -}} {{- partial "icon.html" "corner-down-right" -}}
<p>{{- i18n "latestInSeries" }} <a href="{{ $term.Permalink }}">{{ $term.Title }}</a></p> <p>{{- i18n "latestInSeries" }} <a href="{{ $term.Permalink }}">{{ $term.Title }}</a></p>
</div> </div>
{{- end -}} {{- end -}}
{{- end -}}
{{- end }} {{- end }}
</li> </li>

View File

@@ -1,5 +1,5 @@
{{- if .Params.summary -}} {{- if .Params.summary -}}
{{ .Params.summary }} {{ .Params.summary | markdownify | plainify }}
{{- else -}} {{- else -}}
{{ .Summary | plainify | truncate 180 }} {{ .Summary | plainify | truncate 180 }}
{{- end -}} {{- end -}}

View File

@@ -3,7 +3,7 @@
{{- $tmpScratch := newScratch -}} {{- $tmpScratch := newScratch -}}
{{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}} {{- range $post := (where (where site.Pages.ByDate.Reverse "Section" "blog") ".Kind" "!=" "section") -}}
{{- $term := index ($post.GetTerms "series") 0 -}} {{- $term := index ($post.GetTerms "series") 0 -}}
{{- if $term -}} {{- if (and $term (not ($term.Param "donotunique"))) -}}
{{- if not ($tmpScratch.Get $term.Permalink) -}} {{- if not ($tmpScratch.Get $term.Permalink) -}}
{{- $tmpScratch.Set $term.Permalink true -}} {{- $tmpScratch.Set $term.Permalink true -}}
{{- $scratch.Add "pages" $post -}} {{- $scratch.Add "pages" $post -}}

View File

@@ -17,9 +17,9 @@
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> <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 }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{ with site.Params.author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} <managingEditor>{{.}}{{ with site.Params.author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Params.author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with site.Params.author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }} {{ with .OutputFormats.Get "RSS" }}
@@ -30,7 +30,7 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <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}} {{ with site.Params.author.email }}<author>{{.}}{{ with site.Params.author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description> <description>{{ .Content | html }}</description>
</item> </item>

View File

@@ -1,5 +1,5 @@
{{- $scratch := newScratch -}} {{- $scratch := newScratch -}}
{{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" .Site.Data.submodules) -}} {{- partial "geturl.html" (dict "scratch" $scratch "path" (.Get 0) "siteSourceUrl" .Site.Params.siteSourceUrl "submoduleLinks" hugo.Data.submodules) -}}
{{- $groupconfig := dict {{- $groupconfig := dict
"url" ($scratch.Get "bestUrl") "url" ($scratch.Get "bestUrl")
"basePath" ($scratch.Get "bestPath") "basePath" ($scratch.Get "bestPath")

View File

@@ -1,5 +1,6 @@
<span class="sidenote"> <span class="sidenote">
<label class="sidenote-label" for="{{- .Get 1 -}}">{{- .Get 2 | markdownify -}}</label> <label class="sidenote-label" for="{{- .Get 1 -}}">{{- .Get 2 | markdownify -}}</label>
{{- /* chomp trailing whitespace */ -}}
<input class="sidenote-checkbox" style="display: none;" type="checkbox" id="{{- .Get 1 -}}"></input> <input class="sidenote-checkbox" style="display: none;" type="checkbox" id="{{- .Get 1 -}}"></input>
{{- if $offset := .Get 3 -}} {{- if $offset := .Get 3 -}}
<span class="sidenote-content sidenote-{{- .Get 0 -}}" style="margin-top: {{- $offset -}}rem"> <span class="sidenote-content sidenote-{{- .Get 0 -}}" style="margin-top: {{- $offset -}}rem">
@@ -10,4 +11,6 @@
{{- .Inner -}} {{- .Inner -}}
<span class="sidenote-delimiter">]</span> <span class="sidenote-delimiter">]</span>
</span> </span>
{{- /* chomp trailing whitespace */ -}}
</span> </span>
{{- /* chomp trailing whitespace */ -}}

View File

@@ -0,0 +1,34 @@
{{- /* Note: changing the baseof template because the title, tags, etc. of a regular post are still valid. */ -}}
<!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}">
<head>
{{- partial "head.html" . -}}
{{ $writingcss := resources.Get "scss/writing.scss" | css.Sass | resources.Minify }}
<link rel="stylesheet" href="{{ $writingcss.Permalink }}">
{{ if .Params.custom_css }}
{{ range $customCss := .Params.custom_css }}
{{ $renderedCustomCss := page.Resources.Get $customCss | css.Sass (dict "includePaths" (slice "themes/vanilla/assets/scss")) | resources.Minify }}
<link rel="stylesheet" href="{{ $renderedCustomCss.Permalink }}">
{{ end }}
{{ end }}
</head>
<body>
{{ with .Params.body_start_partial }}
{{ partial . $ }}
{{ end }}
{{- partial "header.html" . -}}
<div class="container"><hr class="header-divider"></div>
<main class="container">
{{- if .Draft -}}
{{- partial "warning.html" (i18n "postDraft") -}}
{{- end -}}
{{- block "main" . }}{{- end }}
</main>
{{- block "after" . }}{{- end }}
</body>
</html>

BIN
static/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB