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 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 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 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, 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 description: Go ahead, touch the Cornballer
greeting: You know [best](https://www.youtube.com/watch?v=1WDW8XKEGgU) greeting: You know [best](https://www.youtube.com/watch?v=1WDW8XKEGgU)
stretch: stretch.jpg stretch: stretch.jpg
title: No Borders, No Limits
--- ---
<p class="lead text-center"> <p class="lead text-center">

View File

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

View File

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

View File

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

View File

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