14 Commits

Author SHA1 Message Date
1f82ad4f0b Add support for twitter:creator tag
Put `twitter` metadata on an author
2025-07-05 02:06:39 -05:00
7e016547ec Remove redundant twitter tags since they falls back to opengraph 2025-07-05 01:46:42 -05:00
b4bff1e36d Use content view to customize <title> on author's page 2025-07-04 15:50:38 -05:00
1f9477759d Revert "debug: Show current template filename in bottom right"
This reverts commit ff4998f31b.

Not that useful. In the future, probably need to make an entire like
debug menu with a bunch of info about the current page rendering and a
bunch of variables.
2025-07-04 15:35:58 -05:00
cc7cec07df Revert "Set height and width specifically on img tag"
This reverts commit be12afb50d.

It causes issues with aspect ratio when the raw width of the image is
wider than the width in CSS pixels allowed by the body max-width.

Not reverting the refactor that removes {{ $img = . }} because I don't
know why that was there and will see if it works fine with it still
removed.
2025-07-03 20:15:17 -05:00
be12afb50d Set height and width specifically on img tag 2025-07-03 18:47:55 -05:00
9d761b2f81 Only index pages; add pagefind metadata based on series/tags/categories 2025-07-02 02:08:01 -05:00
ba9c106a88 Add data-pagefind-body to main content element
In preparation for adding Pagefind search support to bbaovanc.com. Those
templates will just go in the bbaovanc.com tree instead.
2025-07-02 01:21:05 -05:00
150ee40fd5 Fix website title not showing up in OpenGraph tags
I don't know how I never noticed this or how long it's been missing.
Maybe it was never there?
2025-07-02 01:20:11 -05:00
ca0f8d390c Add workaround for code icon being chopped off on side
Introduced by 16f08dce7f. Since the aspect
ratio of the icon isn't square, it's too wide and collides with the text
next to it. Would be nice to follow #82 and switch to a better
maintained icon pack.
2025-07-01 02:57:55 -05:00
62f0d42140 Add possibility for adding custom meta items to page
Fixes #67
2025-07-01 02:48:37 -05:00
16f08dce7f Tweak icon size and alignment
Use em units so it matches the text size automatically. Using sub for
vertical-align seems to look a little nicer? Maybe only so because now
the height of icon matches the font size now.
2025-07-01 02:09:15 -05:00
c06e7eb938 Remove assets/js/share-event.js
Moved this completely to bbaovanc.com repo. I think it was here as a
placeholder purely because of some issue with global resources not
working in the past. It seems like it maybe works fine now though.
2025-07-01 00:52:33 -05:00
5a957bc745 Fix __hugo_ctx in include shortcode
See posts 2 and 3:
https://discourse.gohugo.io/t/weird-hugo-ctx-pid-34-inside-rendershortcodes/55176?u=bbaovanc

The 4 spaces causes it to think it's an inline code block.
2025-06-29 16:18:37 -05:00
19 changed files with 56 additions and 59 deletions

View File

@ -291,17 +291,17 @@ table.simple tbody tr:nth-child(even) {
/* Icons */ /* Icons */
.icon { .icon {
width: 20px; width: 1em;
height: 20px; height: 1em;
color: var(--text-1); color: var(--text-1);
text-align: center; text-align: center;
display: inline; display: inline;
vertical-align: middle; vertical-align: sub;
} }
h1 svg.icon { /* workarounds for some icons from jam-icons being non-square aspect ratio */
width: 30px; .icon-code {
height: 30px; width: 1.25em;
} }
/* }}} */ /* }}} */
@ -315,11 +315,6 @@ h1 svg.icon {
font-weight: bold; font-weight: bold;
} }
.heading-link svg {
width: 15px;
height: 15px;
}
/* }}} */ /* }}} */
/* Top bar formatting {{{ */ /* Top bar formatting {{{ */
@ -676,6 +671,7 @@ h1 svg.icon {
display: flex; display: flex;
gap: 8px; gap: 8px;
justify-content: center; justify-content: center;
font-size: 32px;
} }
.share-buttons a { .share-buttons a {
@ -690,8 +686,7 @@ h1 svg.icon {
} }
.share-buttons svg { .share-buttons svg {
width: 32px; display: block;
height: 32px;
} }
/* https://stackoverflow.com/a/72073682/19003757 */ /* https://stackoverflow.com/a/72073682/19003757 */

View File

@ -1,3 +0,0 @@
function share_event(service) {
// this function does nothing by default
}

View File

@ -7,18 +7,17 @@
{{ end }} {{ end }}
{{ with index . "src" }} {{ with index . "src" }}
{{ $media := . }}
{{ if eq .MediaType.MainType "image" }} {{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" loading="lazy" /> <img src="{{ .Permalink }}" alt="{{ .Title }}" loading="lazy" />
{{ else if eq .MediaType.MainType "video" }} {{ else if eq .MediaType.MainType "video" }}
<video controls preload="metadata"> <video controls preload="metadata">
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}"> <source src="{{ .Permalink }}" alt="{{ .Title }}">
{{ i18n "browser_no_video_support" }} {{ i18n "browser_no_video_support" }}
</video> </video>
{{ end }} {{ end }}
{{ if not $hidecaption }} {{ if not $hidecaption }}
{{ with $media.Title }} {{ with .Title }}
<figcaption> <figcaption>
{{ . | markdownify }} {{ . | markdownify }}
</figcaption> </figcaption>

View File

@ -16,9 +16,6 @@
{{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }} {{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }}
<script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script> <script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }} {{ end }}
{{ with resources.Get "js/share-event.js" | fingerprint "sha512" }}
<script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}
{{ with .Site.Params.faviconSVG }} {{ with .Site.Params.faviconSVG }}
<link rel="icon" href="{{ . | absURL }}" /> <link rel="icon" href="{{ . | absURL }}" />
@ -27,11 +24,7 @@
<link rel="apple-touch-icon" href="{{ . | absURL }}" /> <link rel="apple-touch-icon" href="{{ . | absURL }}" />
{{ end }} {{ end }}
{{ if .IsHome }} <title>{{ .Render "head_title" }}</title>
<title>{{ .Site.Title | plainify }}</title>
{{ else }}
<title>{{ (print .Title " | " .Site.Title) | plainify }}</title>
{{ end }}
{{ partial "seo-tags/opengraph.html" . }} {{ partial "seo-tags/opengraph.html" . }}
{{ partial "seo-tags/twitter-cards.html" . }} {{ partial "seo-tags/twitter-cards.html" . }}

View File

@ -1,6 +1,6 @@
{{- $icon_resource := resources.Get (printf "jam/icons/%s.svg" .) -}} {{- $icon_resource := resources.Get (printf "jam/icons/%s.svg" .) -}}
{{- $icon := $icon_resource.Content -}} {{- $icon := $icon_resource.Content -}}
{{- $icon = replaceRE `<svg` `<svg class="icon"` $icon -}} {{- $icon = replaceRE `<svg` (printf `<svg class="icon icon-%s"` .) $icon -}}
{{- $icon = replaceRE `</svg>` (printf `<title>%s icon</title></svg>` .) $icon -}} {{- $icon = replaceRE `</svg>` (printf `<title>%s icon</title></svg>` .) $icon -}}
{{- $icon = replaceRE `(width|height)="[0-9]*"` "" $icon -}} {{- $icon = replaceRE `(width|height)="[0-9]*"` "" $icon -}}
{{- $icon | safeHTML -}} {{- $icon | safeHTML -}}

View File

@ -0,0 +1 @@
<!-- Placeholder for website to add custom post metadata to summaries -->

View File

@ -1,5 +1,5 @@
{{ with .Params.authors }} {{ with .Params.authors }}
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_authors" }}"> <span class="page-metadata-item" data-pagefind-meta="authors" aria-label="{{ i18n "aria_post_meta_authors" }}">
{{ partial "icon.html" "user-circle" }} {{ partial "icon.html" "user-circle" }}
{{ if index $.Site.Taxonomies "authors" }} {{ if index $.Site.Taxonomies "authors" }}

View File

@ -4,7 +4,7 @@
{{ $categories = $categories | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $categories = $categories | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }} {{ end }}
<div class="page-metadata-section categories" aria-label="{{ i18n "aria_post_meta_categories" }}"> <div class="page-metadata-section categories" data-pagefind-meta="categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
{{ partial "icon.html" "folder" }} {{ partial "icon.html" "folder" }}
{{ delimit $categories ", " | safeHTML }} {{ delimit $categories ", " | safeHTML }}
</div> </div>

View File

@ -4,7 +4,7 @@
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }} {{ end }}
<div class="page-metadata-section series" aria-label="{{ i18n "aria_post_meta_series" }}"> <div class="page-metadata-section series" data-pagefind-meta="series" aria-label="{{ i18n "aria_post_meta_series" }}">
{{ partial "icon.html" "files" }} {{ partial "icon.html" "files" }}
{{ delimit $series ", " | safeHTML }} {{ delimit $series ", " | safeHTML }}
</div> </div>

View File

@ -4,7 +4,7 @@
{{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }} {{ end }}
<div class="page-metadata-section tags" aria-label="{{ i18n "aria_post_meta_tags" }}"> <div class="page-metadata-section tags" data-pagefind-meta="tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
{{ partial "icon.html" "tag" }} {{ partial "icon.html" "tag" }}
{{ delimit $tags ", " | safeHTML }} {{ delimit $tags ", " | safeHTML }}
</div> </div>

View File

@ -22,6 +22,8 @@
{{ partial "page-metadata/item/edithistory.html" . }} {{ partial "page-metadata/item/edithistory.html" . }}
{{ partial "page-metadata/item/viewraw.html" . }} {{ partial "page-metadata/item/viewraw.html" . }}
{{ partial "page-metadata/custom-full.html" . }}
{{ partial "page-metadata/item/categories.html" . }} {{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }} {{ partial "page-metadata/item/tags.html" . }}

View File

@ -9,6 +9,7 @@
{{ partial "page-metadata/item/authors.html" . }} {{ partial "page-metadata/item/authors.html" . }}
{{ partial "page-metadata/item/readingtime.html" . }} {{ partial "page-metadata/item/readingtime.html" . }}
{{ partial "page-metadata/item/series.html" . }} {{ partial "page-metadata/item/series.html" . }}
{{ partial "page-metadata/item/categories.html" . }} {{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }} {{ partial "page-metadata/item/tags.html" . }}

View File

@ -33,7 +33,7 @@
<meta property="og:locale" content="{{ . }}"> <meta property="og:locale" content="{{ . }}">
{{ end }} {{ end }}
{{ with .Site.Params.title }} {{ with .Site.Title }}
<meta property="og:site_name" content="{{ . }}"> <meta property="og:site_name" content="{{ . }}">
{{ end }} {{ end }}

View File

@ -1,3 +1,7 @@
{{/* we do not need to duplicate what's already covered by OpenGraph tags
* see: https://demo.bbaovanc.com/test/remove-twitter-tags/blog/swapfile-guide/
* so, no twitter:image/title/description
*/}}
{{ $images := $.Resources.ByType "image" }} {{ $images := $.Resources.ByType "image" }}
{{ $featured := $images.GetMatch "*feature*" }} {{ $featured := $images.GetMatch "*feature*" }}
{{ if not $featured }} {{ if not $featured }}
@ -17,13 +21,21 @@
{{ else }} {{ else }}
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
{{ end }} {{ end }}
{{ else }}
<meta name="twitter:image" content="{{ $featured.Permalink }}"> <meta name="twitter:card" content="summary">
{{ end }} {{ end }}
<meta name="twitter:title" content="{{ .Title | plainify }}"> {{/* twitter:site is the site author; twitter:creator is page author
<meta name="twitter:description" content="{{ (partial "seo-description.html" .) | plainify }}"> * https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started
* "Card and Content Attribution"
*/}}
{{ with .Site.Params.social.twitter }} {{ with .Site.Params.social.twitter }}
<meta name="twitter:site" content="@{{ . }}"> <meta name="twitter:site" content="@{{ . }}">
{{ end }} {{ end }}
{{ with .GetTerms "authors" }}
{{ range . }}
{{ with .Params.twitter }}
<meta name="twitter:creator" content="@{{ . }}">
{{ end }}
{{ end }}
{{ end }}

View File

@ -1,14 +1,14 @@
{{/* https://github.com/gohugoio/hugo/issues/13823#issuecomment-3015270202 */}} {{/* https://github.com/gohugoio/hugo/issues/13823#issuecomment-3015270202 */}}
{{ with .Get 0 }} {{ with .Get 0 -}}
{{ with $.Page.GetPage . }} {{ with $.Page.GetPage . -}}
{{- .RenderShortcodes }} {{ .RenderShortcodes -}}
{{ else with $.Page.Resources.Get . }} {{ else with $.Page.Resources.Get . -}}
{{- .RenderShortcodes }} {{ .RenderShortcodes -}}
{{ else with resources.Get . }} {{ else with resources.Get . -}}
{{- .Content }} {{ .Content -}}
{{ else }} {{ else -}}
{{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position -}}
{{ end }} {{ end -}}
{{ else }} {{ else -}}
{{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position }} {{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position -}}
{{ end }} {{ end -}}

View File

@ -0,0 +1 @@
{{ (print .Title "'s Posts | " .Site.Title) | plainify }}

View File

@ -8,18 +8,12 @@
{{ partial "top.html" . }} {{ partial "top.html" . }}
{{ if hugo.IsServer -}}
<div style="position: fixed; bottom: 25px; right: 25px;">
{{ templates.Current.Name }}
</div>
{{ end -}}
<div class="main-container"> <div class="main-container">
{{ if not .IsHome }} {{ if not .IsHome }}
{{ partial "breadcrumb.html" . }} {{ partial "breadcrumb.html" . }}
{{ end }} {{ end }}
<main id="main-content"> <main id="main-content" {{ if .IsPage }}data-pagefind-body{{ end }}>
{{ block "main" . }} {{ block "main" . }}
THIS TEXT SHOULD NOT SHOW. YUZSIQGHE (that string is so I can grep for it) THIS TEXT SHOULD NOT SHOW. YUZSIQGHE (that string is so I can grep for it)
{{ end }} {{ end }}

1
layouts/head_title.html Normal file
View File

@ -0,0 +1 @@
{{ (print .Title " | " .Site.Title) | plainify }}

View File

@ -0,0 +1 @@
{{ .Site.Title | plainify }}