1 Commits

Author SHA1 Message Date
bbab41e90f WIP table of contents 2023-10-21 21:49:04 -05:00
18 changed files with 81 additions and 53 deletions

View File

@ -8,7 +8,7 @@ comments: true
draft: true
authors:
- {{ with .Site.Params.author.name }}{{ . }}{{ else }}John Doe{{ end }}
- {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
categories:
- archetype-stuff

View File

@ -6,7 +6,7 @@ toc: true
comments: false
authors:
- {{ with .Site.params.author.name }}{{ . }}{{ else }}John Doe{{ end }}
- {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
---

View File

@ -361,6 +361,23 @@ h1 svg.icon {
/* }}} */
/* Back to top {{{ */
#top {
font-size: 0;
}
#back-to-top {
position: fixed;
float: right;
bottom: 25px;
right: 25px;
background-color: var(--background-1);
color: var(--text-1);
border-radius: 100%;
padding: 12px;
display: none;
}
/* }}} */
/* Skip to main content {{{ */
#skip-to-main {
position: absolute;
@ -641,7 +658,7 @@ h1 svg.icon {
/* Content (single) formatting {{{ */
.series-box {
background-color: var(--background-1); /* remember to update print styling */
background-color: var(--background-1);
color: var(--text-1);
padding: 8px 16px;
border-radius: 8px;
@ -649,7 +666,7 @@ h1 svg.icon {
}
.table-of-contents {
background-color: var(--background-1); /* remember to update print styling */
background-color: var(--background-1);
color: var(--text-1);
padding: 8px 20px;
border-radius: 8px;
@ -704,7 +721,7 @@ h1 svg.icon {
/* See also formating */
.see-also {
background-color: var(--background-1); /* remember to update print styling */
background-color: var(--background-1);
color: var(--text-1);
padding: 8px 12px;
border-radius: 8px;
@ -770,14 +787,14 @@ h1 svg.icon {
display: flex;
flex-direction: column;
margin: 16px 0;
background-color: var(--background-1); /* remember to update print styling */
background-color: var(--background-1);
border-radius: 8px;
}
.code-block > .code-header {
display: flex;
flex-direction: row;
justify-content: space-between;
background-color: var(--background-2); /* remember to update print styling */
background-color: var(--background-2);
padding: 4px 8px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
@ -857,7 +874,6 @@ aside {
margin-bottom: 0;
}
/* remember to update print styling for all the following asides */
aside.note {
background-color: var(--background-blue-1);
}
@ -966,26 +982,22 @@ aside.quote {
break-inside: avoid;
}
.table-of-contents {
.table-of-contents:not(.print) {
display: none;
}
.table-of-contents.print {
display: block;
background-color: unset;
padding: 0;
}
.table-of-contents.print ul {
margin: 0;
}
/* replace background colors with borders {{{ */
.series-box {
#back-to-top {
display: none !important;
}
.table-of-contents {
}
.see-also {
}
.code-block {
}
.code-block > .code-header {
}
/* all the asides */
}
/* }}} */

View File

@ -5,17 +5,16 @@
color: black;
}
/* Background */ .bg { background-color: #f8f8f8; }
/* Background */ .bg { background-color: #f8f8f8 }
/* PreWrapper */ .chroma { background-color: #f8f8f8; }
/* Other */ .chroma .x { color: #000000 }
/* Error */ .chroma .err { color: #a40000 }
/* CodeLine */ .chroma .cl { }
/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #dfdfdf }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #204a87; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #204a87; font-weight: bold }

View File

@ -1,16 +1,15 @@
/* native style */
/* Background */ .bg { color: #d0d0d0; background-color: #202020; }
/* Background */ .bg { color: #d0d0d0; background-color: #202020 }
/* PreWrapper */ .chroma { color: #d0d0d0; background-color: #202020; }
/* Other */ .chroma .x { }
/* Error */ .chroma .err { color: #a61717; background-color: #e3d2d2 }
/* CodeLine */ .chroma .cl { }
/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
/* LineHighlight */ .chroma .hl { background-color: #363636 }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #686868 }
/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #686868 }
/* LineHighlight */ .chroma .hl { background-color: #ffffcc }
/* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #686868 }
/* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #686868 }
/* Line */ .chroma .line { display: flex; }
/* Keyword */ .chroma .k { color: #6ab825; font-weight: bold }
/* KeywordConstant */ .chroma .kc { color: #6ab825; font-weight: bold }

View File

@ -1,3 +1,13 @@
// back to top
const backToTop = document.getElementById("back-to-top");
window.onscroll = function() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
backToTop.style.display = "block";
} else {
backToTop.style.display = "none";
}
}
// code block copy to clipboard
window.onload = () => {
document.querySelectorAll(".code-block").forEach(codeBlock => {

View File

@ -10,13 +10,13 @@ enableGitInfo: true
taxonomies:
_merge: deep
author:
name: bbaovanc
markup: # this just keeps the bobatheme markup styling
_merge: deep
params:
author:
name: bbaovanc
# these are for the OpenGraph/Twitter embeds in Hugo
description: Example website for bobatheme

View File

@ -4,8 +4,20 @@
{{ partial "head.html" . }}
<body>
<a id="top" aria-hidden="true"></a>
<a id="skip-to-main" href="#main-content">Skip to main content</a>
<a id="back-to-top" href="#top" aria-label="{{ i18n "aria_back_to_top_button" }}">
{{ partial "icon.html" "chevron-up" }}
</a>
<noscript>
<style>
#back-to-top {
display: block;
}
</style>
</noscript>
{{ partial "top.html" . }}
<div class="main-container">
@ -27,7 +39,7 @@
{{ if or .Site.Copyright .Site.Params.footer }}
<footer>
{{ with .Site.Copyright }}
{{ . | safeHTML }}
<p>{{ . | safeHTML }}</p>
{{ end }}
{{ with .Site.Params.footer }}

View File

@ -9,7 +9,7 @@
{{ with index . "src" }}
{{ $media := . }}
{{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" loading="lazy" />
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
{{ else if eq .MediaType.MainType "video" }}
<video controls preload="metadata">
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">

View File

@ -7,10 +7,10 @@
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ with resources.Get "css/syntax.css" | fingerprint "sha512" }}
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" media="print" onload="this.media='all'">
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ with resources.Get "css/syntax-light.css" | fingerprint "sha512" }}
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" media="print" onload="this.media='all'">
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }}

View File

@ -6,9 +6,9 @@
{{ $authors := slice }}
{{ range . }}
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url .) }}
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
{{ end }}
{{ delimit $authors ", " | safeHTML }}
{{ delimit $authors ", " }}
{{ else }}
{{ delimit . ", " }}
{{ end }}

View File

@ -6,6 +6,6 @@
<div class="page-metadata-section categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
{{ partial "icon.html" "folder" }}
{{ delimit $categories ", " | safeHTML }}
{{ delimit $categories ", " }}
</div>
{{ end }}

View File

@ -6,6 +6,6 @@
<div class="page-metadata-section series" aria-label="{{ i18n "aria_post_meta_series" }}">
{{ partial "icon.html" "files" }}
{{ delimit $series ", " | safeHTML }}
{{ delimit $series ", " }}
</div>
{{ end }}

View File

@ -6,6 +6,6 @@
<div class="page-metadata-section tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
{{ partial "icon.html" "tag" }}
{{ delimit $tags ", " | safeHTML }}
{{ delimit $tags ", " }}
</div>
{{ end }}

View File

@ -10,7 +10,7 @@
{{ end }}
{{ if eq $type "image" }}
<img src="{{ $src }}" alt="{{ $alt }}" loading="lazy" />
<img src="{{ $src }}" alt="{{ $alt }}" />
{{ else if eq $type "video" }}
<video controls preload="metadata">
<source src="{{ $src }}" alt="{{ $alt }}">

View File

@ -21,14 +21,10 @@
<meta itemprop="image" content="{{ $featured.Permalink }}">
{{ end }}
{{ with .Keywords }}
<meta itemprop="keywords" content="{{ delimit . ", " }}">
{{ else }}
{{ with (.GetTerms "tags") }}
{{ $tags := slice }}
{{ range . }}
{{ $tags = $tags | append .LinkTitle }}
{{ end }}
<meta itemprop="keywords" content="{{ delimit $tags ", " }}">
{{ with (.GetTerms "tags") }}
{{ $tags := slice }}
{{ range . }}
{{ $tags = $tags | append .LinkTitle }}
{{ end }}
<meta itemprop="keywords" content="{{ delimit $tags ", " }}">
{{ end }}

View File

@ -12,6 +12,6 @@
This post is part of a series:
{{ end }}
{{ delimit $series ", " | safeHTML }}
{{ delimit $series ", " }}
</div>
{{ end }}