Unify HTML and RSS titles

This commit is contained in:
Will Faught
2022-12-11 02:01:53 -08:00
parent 10382fed51
commit 602a71e593
6 changed files with 28 additions and 13 deletions

View File

@@ -60,7 +60,8 @@ The HTML keywords is a union of the page keywords, tags, and categories.
The HTML title is the page title, followed by a middle dot, followed by
the site title. If one is missing, the other is used without the middle
dot. If both are the same, only one is used without the middle dot.
dot. If both are the same for the home page, the title is the page
title.
The HTML body can have a header, a body, and a footer. The header has
the section menus, if any; the page title, if any; the page description,

View File

@@ -3,7 +3,6 @@ blurb: There's a new daddy in town. A discipline daddy. If I make this comeback,
description: Go ahead, touch the Cornballer
greeting: You know [best](https://www.youtube.com/watch?v=1WDW8XKEGgU)
stretch: stretch.jpg
title: No Borders, No Limits
---
<p class="lead text-center">

View File

@@ -1,10 +1,14 @@
{{ define "main" }}
{{ if .Title }}
{{ $title := .Title }}
{{ if not $title }}
{{ $title = .Site.Title }}
{{ end }}
{{ if $title }}
<h1 class="display-1 fw-bold text-center">
{{ if .Params.link }}
<a href="{{ .Params.link }}">{{ .Title | markdownify }}</a>
<a href="{{ .Params.link }}">{{ $title | markdownify }}</a>
{{ else }}
{{ .Title | markdownify }}
{{ $title | markdownify }}
{{ end }}
</h1>
{{ end }}

View File

@@ -1,6 +1,6 @@
<head>
{{ partial "paige_meta.html" . }}
{{ partial "paige_title.html" . }}
<title>{{ partial "paige_title.html" . }}</title>
{{ partial "paige_link.html" . }}
{{ partial "paige_style.html" . }}
{{ if templates.Exists "partials/paige_head_last.html" }}

View File

@@ -3,6 +3,9 @@
{{ if or .Site.Params.math .Params.math }}
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.css" integrity="sha384-Juol1FqnotbkyZUT5Z7gUPjQ9gzlwCENvUZTpQBAPxtusdwFLRy382PSDx5UUJ4/" rel="stylesheet">
{{ end }}
{{ if .AlternativeOutputFormats }}
{{ $title := partial "paige_title.html" . }}
{{ range .AlternativeOutputFormats }}
<link href="{{ .Permalink }}" rel="{{ .Rel }}" title="{{ $.Site.Title }}" type="{{ .MediaType.Type }}">
<link href="{{ .Permalink }}" rel="{{ .Rel }}" title="{{ $title }}" type="{{ .MediaType.Type }}">
{{ end }}
{{ end }}

View File

@@ -1,7 +1,15 @@
{{ if and (and .Title .Site.Title) (or (not (eq .Title .Site.Title)) (not .IsHome)) }}
<title>{{ .Title | markdownify | plainify | htmlUnescape }} &middot; {{ .Site.Title | markdownify | plainify | htmlUnescape }}</title>
{{ else if .Title }}
<title>{{ .Title | markdownify | plainify | htmlUnescape }}</title>
{{ else if .Site.Title }}
<title>{{ .Site.Title | markdownify | plainify | htmlUnescape }}</title>
{{ $title := "" }}
{{ $pageTitle := .Title | markdownify | plainify | htmlUnescape }}
{{ $siteTitle := .Site.Title | markdownify | plainify | htmlUnescape }}
{{ if and .Title .Site.Title }}
{{ if .IsHome }}
{{ $title = $pageTitle }}
{{ else }}
{{ $title = printf "%s · %s" $pageTitle $siteTitle }}
{{ end }}
{{ else if .Title }}
{{ $title = $pageTitle }}
{{ else if .Site.Title }}
{{ $title = $siteTitle }}
{{ end }}
{{ return $title }}