mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2025-07-06 20:17:30 -05:00
Compare commits
2 Commits
rewrite-fi
...
hugo-0.146
Author | SHA1 | Date | |
---|---|---|---|
7c79f83138
|
|||
fa89bc6746
|
@ -198,14 +198,14 @@ video {
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-media > figure img,
|
.post-media > figure.border img,
|
||||||
.post-media > figure video {
|
.post-media > figure.border video {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 7px solid var(--figure-border);
|
border: 7px solid var(--figure-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
figure img,
|
figure.border img,
|
||||||
figure video {
|
figure.border video {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 2px solid var(--figure-border);
|
border: 2px solid var(--figure-border);
|
||||||
}
|
}
|
||||||
@ -291,17 +291,17 @@ table.simple tbody tr:nth-child(even) {
|
|||||||
|
|
||||||
/* Icons */
|
/* Icons */
|
||||||
.icon {
|
.icon {
|
||||||
width: 1em;
|
width: 20px;
|
||||||
height: 1em;
|
height: 20px;
|
||||||
color: var(--text-1);
|
color: var(--text-1);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: inline;
|
display: inline;
|
||||||
vertical-align: sub;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* workarounds for some icons from jam-icons being non-square aspect ratio */
|
h1 svg.icon {
|
||||||
.icon-code {
|
width: 30px;
|
||||||
width: 1.25em;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@ -315,6 +315,11 @@ table.simple tbody tr:nth-child(even) {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.heading-link svg {
|
||||||
|
width: 15px;
|
||||||
|
height: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* Top bar formatting {{{ */
|
/* Top bar formatting {{{ */
|
||||||
@ -671,7 +676,6 @@ table.simple tbody tr:nth-child(even) {
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 32px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-buttons a {
|
.share-buttons a {
|
||||||
@ -686,7 +690,8 @@ table.simple tbody tr:nth-child(even) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.share-buttons svg {
|
.share-buttons svg {
|
||||||
display: block;
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* https://stackoverflow.com/a/72073682/19003757 */
|
/* https://stackoverflow.com/a/72073682/19003757 */
|
||||||
|
3
assets/js/share-event.js
Normal file
3
assets/js/share-event.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function share_event(service) {
|
||||||
|
// this function does nothing by default
|
||||||
|
}
|
68
exampleSite/hugo.yaml
Normal file
68
exampleSite/hugo.yaml
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
baseURL: https://example.com
|
||||||
|
theme: bobatheme
|
||||||
|
defaultContentLanguage: en
|
||||||
|
copyright: '© 2021 bbaovanc <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>'
|
||||||
|
sectionPagesMenu: main
|
||||||
|
enableRobotsTXT: true
|
||||||
|
enableGitInfo: true
|
||||||
|
|
||||||
|
pagination:
|
||||||
|
pagerSize: 5
|
||||||
|
|
||||||
|
taxonomies:
|
||||||
|
_merge: deep
|
||||||
|
|
||||||
|
markup: # this just keeps the bobatheme markup styling
|
||||||
|
_merge: deep
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
_merge: deep
|
||||||
|
|
||||||
|
outputFormats:
|
||||||
|
_merge: deep
|
||||||
|
|
||||||
|
params:
|
||||||
|
author:
|
||||||
|
name: bbaovanc
|
||||||
|
|
||||||
|
# these are for the OpenGraph/Twitter embeds in Hugo
|
||||||
|
description: Example website for bobatheme
|
||||||
|
|
||||||
|
# these are for favicons in bobatheme (disabled by default)
|
||||||
|
# faviconSVG: favicon.svg
|
||||||
|
# appleTouchPNG: apple-touch-icon.png
|
||||||
|
|
||||||
|
# show reading time (enabled by default)
|
||||||
|
# readingtime: true
|
||||||
|
|
||||||
|
# used for "View source" (unset by default)
|
||||||
|
# gitFileURL: https://github.com/BBaoVanC/bobatheme/blob/master
|
||||||
|
# gitFileIcon: github-circle
|
||||||
|
# gitHistoryURL: https://github.com/BBaoVanC/bobatheme/commits/master
|
||||||
|
|
||||||
|
# social media share icons
|
||||||
|
# shareButtons:
|
||||||
|
# twitter: true
|
||||||
|
# facebook: true
|
||||||
|
# linkedin: true
|
||||||
|
# reddit: true
|
||||||
|
# telegram: true
|
||||||
|
# print: true
|
||||||
|
|
||||||
|
# show "Latest Posts" section at bottom of content pages
|
||||||
|
# latestPostsOnContent: true
|
||||||
|
|
||||||
|
# footer: >-
|
||||||
|
# Some example text for the footer.
|
||||||
|
|
||||||
|
|
||||||
|
# see https://gohugo.io/about/hugo-and-gdpr/#all-privacy-settings
|
||||||
|
# you probably want to keep this default
|
||||||
|
privacy:
|
||||||
|
_merge: deep
|
||||||
|
|
||||||
|
languages:
|
||||||
|
en:
|
||||||
|
languageName: English
|
||||||
|
title: Example Website
|
||||||
|
weight: 1
|
@ -4,8 +4,6 @@ markup:
|
|||||||
lineNos: true
|
lineNos: true
|
||||||
goldmark:
|
goldmark:
|
||||||
parser:
|
parser:
|
||||||
# don't put <p> around ![]() image in markdown (used to embed any resource now)
|
|
||||||
wrapStandAloneImageWithinParagraph: false
|
|
||||||
attribute:
|
attribute:
|
||||||
block: true
|
block: true
|
||||||
# this is enabled by default already
|
# this is enabled by default already
|
||||||
|
@ -7,8 +7,6 @@ table_of_contents:
|
|||||||
|
|
||||||
browser_no_video_support:
|
browser_no_video_support:
|
||||||
other: "Your browser does not support video."
|
other: "Your browser does not support video."
|
||||||
browser_no_video_support_link:
|
|
||||||
other: "Click here to download it instead."
|
|
||||||
|
|
||||||
latest_posts:
|
latest_posts:
|
||||||
other: "Latest Posts"
|
other: "Latest Posts"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{{ partial "breadcrumb.html" . }}
|
{{ partial "breadcrumb.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<main id="main-content" {{ if .IsPage }}data-pagefind-body{{ end }}>
|
<main id="main-content">
|
||||||
{{ 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 }}
|
@ -22,7 +22,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ partial "feature-figure.html" . }}
|
{{ with .Resources.GetMatch "feature" }}
|
||||||
|
<div class="post-media">
|
||||||
|
{{ partial "figure.html" (dict "src" .) }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<article class="post-content">
|
<article class="post-content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
@ -6,7 +6,11 @@
|
|||||||
|
|
||||||
{{ partial "page-metadata/post-short.html" . }}
|
{{ partial "page-metadata/post-short.html" . }}
|
||||||
|
|
||||||
{{ partial "feature-figure.html" . }}
|
{{ with .Resources.GetMatch "feature" }}
|
||||||
|
<div class="post-media">
|
||||||
|
{{ partial "figure.html" (dict "src" .) }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<div class="page-description">
|
<div class="page-description">
|
||||||
{{ partial "description-or-summary.html" . }}
|
{{ partial "description-or-summary.html" . }}
|
@ -1,12 +0,0 @@
|
|||||||
{{/* TODO: should we use .PageInner */}}
|
|
||||||
{{ partial "embed-resource.html" (.Page.Resources.Get .Destination) }}
|
|
||||||
{{ with .Title }}
|
|
||||||
{{ errorf "%q" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ with .Attributes }}
|
|
||||||
{{/* FIXME: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_markup/render-image.html */}}
|
|
||||||
{{ errorf "%q" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ with .Text }}
|
|
||||||
{{ errorf "%q" . }}
|
|
||||||
{{ end }}
|
|
@ -1,21 +0,0 @@
|
|||||||
{{ if eq .ResourceType "image" }}
|
|
||||||
{{/* TODO: figure out whether loading="lazy" should be set because MDN
|
|
||||||
* claims that images won't work with JS disabled since it would
|
|
||||||
* make tracking possible, but my experience says otherwise
|
|
||||||
*/}}
|
|
||||||
<img src="{{ .Permalink }}" {{ with .Params.alt }}alt="{{ . }}"{{ end }} />
|
|
||||||
{{ else if eq .ResourceType "video" }}
|
|
||||||
<video controls preload="metadata">
|
|
||||||
{{/* FIXME
|
|
||||||
<source src="{{ .Permalink }}" {{ with .Params.alt }}alt="{{ . }}"{{ end }} />
|
|
||||||
*/}}
|
|
||||||
{{ i18n "browser_no_video_support" }}
|
|
||||||
<a href="{{ .Permalink }}" target="_blank" rel="noopener">
|
|
||||||
{{ i18n "browser_no_video_support_link" }}
|
|
||||||
</video>
|
|
||||||
{{ else }}
|
|
||||||
{{/* TODO: could consider implementing more types, listed at:
|
|
||||||
* https://www.iana.org/assignments/media-types/media-types.xhtml
|
|
||||||
*/}}
|
|
||||||
{{ errorf "Handling %q resource not supported" .ResourceType }}
|
|
||||||
{{ end }}
|
|
@ -1,10 +0,0 @@
|
|||||||
{{ with .Resources.Get "feature" }}
|
|
||||||
<div class="post-media">
|
|
||||||
<figure>
|
|
||||||
{{ partial "embed-resource.html" . }}
|
|
||||||
{{ with .Title }}
|
|
||||||
<figcaption>{{ . }}</figcaption>
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
@ -1 +0,0 @@
|
|||||||
<!-- Placeholder for website to add custom post metadata to summaries -->
|
|
@ -1,17 +0,0 @@
|
|||||||
<figure>
|
|
||||||
{{ with .Get "src" }}
|
|
||||||
{{ with $.Page.Resources.Get . }}
|
|
||||||
{{ partial "embed-resource.html" . }}
|
|
||||||
{{ with .Title }}
|
|
||||||
<figcaption>{{ . | markdownify }}</figcaption>
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ errorf "resource %q not found" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ .Inner }}
|
|
||||||
{{ with .Get "caption" }}
|
|
||||||
<figcaption>{{ . | markdownify }}</figcaption>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</figure>
|
|
@ -1,14 +0,0 @@
|
|||||||
{{/* https://github.com/gohugoio/hugo/issues/13823#issuecomment-3015270202 */}}
|
|
||||||
{{ with .Get 0 -}}
|
|
||||||
{{ with $.Page.GetPage . -}}
|
|
||||||
{{ .RenderShortcodes -}}
|
|
||||||
{{ else with $.Page.Resources.Get . -}}
|
|
||||||
{{ .RenderShortcodes -}}
|
|
||||||
{{ else with resources.Get . -}}
|
|
||||||
{{ .Content -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position -}}
|
|
||||||
{{ end -}}
|
|
||||||
{{ else -}}
|
|
||||||
{{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position -}}
|
|
||||||
{{ end -}}
|
|
@ -1,9 +0,0 @@
|
|||||||
{{ with .Get 0 }}
|
|
||||||
{{ with $.Page.Resources.Get . }}
|
|
||||||
{{ partial "embed-resource.html" . }}
|
|
||||||
{{ else }}
|
|
||||||
{{ errorf "resource %q not found" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ errorf "resource name not provided as first parameter" }}
|
|
||||||
{{ end }}
|
|
@ -1 +0,0 @@
|
|||||||
{{ (print .Title "'s Posts | " .Site.Title) | plainify }}
|
|
@ -1 +0,0 @@
|
|||||||
{{ (print .Title " | " .Site.Title) | plainify }}
|
|
@ -1 +0,0 @@
|
|||||||
{{ .Site.Title | plainify }}
|
|
28
layouts/partials/figure.html
Normal file
28
layouts/partials/figure.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{{ $hidecaption := index . "hidecaption" }}
|
||||||
|
|
||||||
|
{{ if index . "noborder" }}
|
||||||
|
<figure>
|
||||||
|
{{ else }}
|
||||||
|
<figure class="border">
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with index . "src" }}
|
||||||
|
{{ $media := . }}
|
||||||
|
{{ if eq .MediaType.MainType "image" }}
|
||||||
|
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" loading="lazy" />
|
||||||
|
{{ else if eq .MediaType.MainType "video" }}
|
||||||
|
<video controls preload="metadata">
|
||||||
|
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
|
||||||
|
{{ i18n "browser_no_video_support" }}
|
||||||
|
</video>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not $hidecaption }}
|
||||||
|
{{ with $media.Title }}
|
||||||
|
<figcaption>
|
||||||
|
{{ . | markdownify }}
|
||||||
|
</figcaption>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</figure>
|
@ -16,6 +16,9 @@
|
|||||||
{{ 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 }}" />
|
||||||
@ -24,7 +27,11 @@
|
|||||||
<link rel="apple-touch-icon" href="{{ . | absURL }}" />
|
<link rel="apple-touch-icon" href="{{ . | absURL }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<title>{{ .Render "head_title" }}</title>
|
{{ if .IsHome }}
|
||||||
|
<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" . }}
|
@ -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` (printf `<svg class="icon icon-%s"` .) $icon -}}
|
{{- $icon = replaceRE `<svg` `<svg class="icon"` $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 -}}
|
@ -1,5 +1,5 @@
|
|||||||
{{ with .Params.authors }}
|
{{ with .Params.authors }}
|
||||||
<span class="page-metadata-item" data-pagefind-meta="authors" aria-label="{{ i18n "aria_post_meta_authors" }}">
|
<span class="page-metadata-item" 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" }}
|
@ -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" data-pagefind-meta="categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
|
<div class="page-metadata-section categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
|
||||||
{{ partial "icon.html" "folder" }}
|
{{ partial "icon.html" "folder" }}
|
||||||
{{ delimit $categories ", " | safeHTML }}
|
{{ delimit $categories ", " | safeHTML }}
|
||||||
</div>
|
</div>
|
@ -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" data-pagefind-meta="series" aria-label="{{ i18n "aria_post_meta_series" }}">
|
<div class="page-metadata-section series" aria-label="{{ i18n "aria_post_meta_series" }}">
|
||||||
{{ partial "icon.html" "files" }}
|
{{ partial "icon.html" "files" }}
|
||||||
{{ delimit $series ", " | safeHTML }}
|
{{ delimit $series ", " | safeHTML }}
|
||||||
</div>
|
</div>
|
@ -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" data-pagefind-meta="tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
|
<div class="page-metadata-section tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
|
||||||
{{ partial "icon.html" "tag" }}
|
{{ partial "icon.html" "tag" }}
|
||||||
{{ delimit $tags ", " | safeHTML }}
|
{{ delimit $tags ", " | safeHTML }}
|
||||||
</div>
|
</div>
|
@ -22,8 +22,6 @@
|
|||||||
{{ 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" . }}
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
{{ 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" . }}
|
28
layouts/partials/remote_figure.html
Normal file
28
layouts/partials/remote_figure.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{{ $hidecaption := index . "hidecaption" }}
|
||||||
|
{{ $type := index . "type" }}
|
||||||
|
{{ $src := index . "src" }}
|
||||||
|
{{ $alt := index . "alt" }}
|
||||||
|
|
||||||
|
{{ if index . "border" }}
|
||||||
|
<figure class="border">
|
||||||
|
{{ else }}
|
||||||
|
<figure>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if eq $type "image" }}
|
||||||
|
<img src="{{ $src }}" alt="{{ $alt }}" loading="lazy" />
|
||||||
|
{{ else if eq $type "video" }}
|
||||||
|
<video controls preload="metadata">
|
||||||
|
<source src="{{ $src }}" alt="{{ $alt }}">
|
||||||
|
{{ i18n "browser_no_video_support" }}
|
||||||
|
</video>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not $hidecaption }}
|
||||||
|
{{ with $alt }}
|
||||||
|
<figcaption>
|
||||||
|
{{ . | markdownify }}
|
||||||
|
</figcaption>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</figure>
|
@ -33,7 +33,7 @@
|
|||||||
<meta property="og:locale" content="{{ . }}">
|
<meta property="og:locale" content="{{ . }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Site.Title }}
|
{{ with .Site.Params.title }}
|
||||||
<meta property="og:site_name" content="{{ . }}">
|
<meta property="og:site_name" content="{{ . }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -1,7 +1,3 @@
|
|||||||
{{/* 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 }}
|
||||||
@ -21,21 +17,13 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
|
||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:image" content="{{ $featured.Permalink }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* twitter:site is the site author; twitter:creator is page author
|
<meta name="twitter:title" content="{{ .Title | plainify }}">
|
||||||
* https://developer.x.com/en/docs/x-for-websites/cards/guides/getting-started
|
<meta name="twitter:description" content="{{ (partial "seo-description.html" .) | plainify }}">
|
||||||
* "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 }}
|
|
15
layouts/shortcodes/figure.html
Normal file
15
layouts/shortcodes/figure.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{{ $resource := .Page.Resources.GetMatch (.Get "src") }}
|
||||||
|
|
||||||
|
{{ $noborder := false }}
|
||||||
|
{{ if .Get "noborder" }}
|
||||||
|
{{ $noborder = true }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $hidecaption := false }}
|
||||||
|
{{ if .Get "hidecaption" }}
|
||||||
|
{{ $hidecaption = true }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ partial "figure.html" (dict "src" $resource "noborder" $noborder "hidecaption" $hidecaption) }}
|
||||||
|
</p>
|
20
layouts/shortcodes/include.html
Normal file
20
layouts/shortcodes/include.html
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{{ $path := "" }}
|
||||||
|
{{ $markdown := false }}
|
||||||
|
{{ if .IsNamedParams }}
|
||||||
|
{{ $path = .Get "path" }}
|
||||||
|
{{ with .Get "markdown" }}
|
||||||
|
{{ $markdown = . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $path = .Get 0 }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with ($path | readFile) }}
|
||||||
|
{{ if $markdown }}
|
||||||
|
{{ $path | readFile | $.Page.RenderString (dict "display" "block") }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $path | readFile }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ errorf "file not found: %s" $path }}
|
||||||
|
{{ end }}
|
13
layouts/shortcodes/remote-figure.html
Normal file
13
layouts/shortcodes/remote-figure.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{{ $border := false }}
|
||||||
|
{{ if .Get "border" }}
|
||||||
|
{{ $border = true }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $hidecaption := false }}
|
||||||
|
{{ if .Get "hidecaption" }}
|
||||||
|
{{ $hidecaption = true }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ partial "remote_figure.html" (dict "src" (.Get "src") "border" $border "hidecaption" $hidecaption "type" (.Get "type") "alt" (.Get "alt")) }}
|
||||||
|
</p>
|
Reference in New Issue
Block a user