theme: simplify, simplify, simplify

- Ports everything that was deported to the site directory as it was
  considered as specific to *my* personal site. But I'm the only one to
  use this theme.

Co-Authored-by: iGor milhit <igor@milhit.ch>
iGor milhit 2026-06-12 14:19:42 +02:00
parent 34699ff5ff
commit 9d8cf45b36
Signed by: igor
GPG Key ID: 692D97C3D0228A99
12 changed files with 197 additions and 9 deletions

View File

@ -0,0 +1,43 @@
// The following rules are styling the stream player
// that I'm using on top of live section pages.
// It doesn't belong to the theme, but to my website
// so it is here.
@use "@picocss/pico/scss/colors/index" as *;
.stream {
.status-player {
display: flex;
audio {
border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0;
}
}
}
// Rules used by the off and on classes below
@mixin status {
display: flex;
border-radius: var(--pico-border-radius) 0 0 var(--pico-border-radius);
flex-grow: 1;
flex-direction: column;
justify-content: space-around;
text-transform: uppercase;
font-weight: bold;
text-align: center;
padding: 0 calc(var(--pico-spacing)/2);
margin: 0;
color: $grey-50;
}
.off {
@include status;
background-color: $red-500;
}
.on {
@include status;
background-color: $green-500;
}
// End of the stream section

View File

@ -12,4 +12,5 @@
@use "footer";
@use "lists"; /* Lists, post-infos, posts-lists */
@use "medias"; /* Audio, streams, figures, post-images */
@use "stream"; /* Specific to the stream player */
@use "texts";

View File

@ -1,4 +1,6 @@
address = "Address"
announcedLive = "Announce of the next live!"
announce = "Announce!"
audioDownload = "Your browser does not support the audio tag, you can access the file directly with"
categories = "Categories"
contactsPriv = "Personal contacts"

View File

@ -1,4 +1,6 @@
address = "Adresse"
announcedLive = "Annonce du prochain live!"
announce = "Annonce!"
audioDownload = "Ton navigateur ne supporte pas la balise audio, tu peux télécharger le fichier avec"
categories = "Catégories"
contactsPriv = "Contacts personnels"

View File

@ -9,4 +9,9 @@
</main>
{{- partial "footer.html" . -}}
</body>
<!-- local_include sets the presence of the script for the on/off button
for the live player. -->
{{ if .Params.local_include }}
<script src="/js/on_fiber.js"></script>
{{ end }}
</html>

View File

@ -11,17 +11,24 @@
<section class="posts-list">
<!--
Ranges pages by the publish date, in reverse order, to display the
post titles of the section from most recent to older. It adds to
the title the date and categories (from lists-footer.html).
post titles of the section from most recent to older. If the pages
has the parameter announce, then it displays a marked warning.
-->
{{ range .Pages.ByPublishDate.Reverse }}
<article>
<a href="{{ .Permalink }}">
{{.Title}}
</a>
{{ partial "lists-footer.html" . }}
</article>
<article>
{{ if .Params.Announce }}
<a href="{{ .Permalink }}"
title="{{ i18n "announcedLive" }}">
{{- .Title -}}
</a> <mark>{{ i18n "announce" }}</mark>
{{ else }}
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
{{ end }}
{{ partial "lists-footer.html" . }}
</article>
{{ end }}
</section>
</main>
{{ end }}

View File

@ -51,4 +51,7 @@
</li>
</ul>
</nav>
{{ if .Params.local_include }}
{{ partial "stream.html" }}
{{ end }}
</header>

View File

@ -6,9 +6,16 @@
-->
{{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }}
<article>
<a href="{{ .Permalink }}">
{{ if .Params.Announce }}
<a href="{{ .Permalink }}"
title="{{ i18n "announcedLive" }}">
{{- .Title -}}
</a> <mark>{{ i18n "announce" }}</mark>
{{ else }}
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
{{ end }}
</article>
{{ end }}
</section>

View File

@ -0,0 +1,18 @@
<figure class="stream">
<div class="status-player">
<p id="on"></p>
<audio controls>
<source src="https://id-libre.org/live/stream.ogg" type="audio/ogg">
<source src="https://id-libre.org/live/stream.mp3" type="audio/mp3">
<p>Your browser does not support the <code>audio</code> element.</p>
</audio>
</div>
<figcaption>
<p>
Écouter le flux (s'il est «on»).
Pour utiliser ton propre client:
<a href="https://id-libre.org/live/stream.ogg">OGG</a>
<a href="https://id-libre.org/live/stream.mp3">MP3</a>
</p>
</figcaption>
</figure>

View File

@ -0,0 +1,4 @@
<!-- Author: Parsia Hakimian https://github.com/parsiya/Hugo-Shortcodes -->
<!-- abbr HTML tag -->
<abbr title="{{ .Get "title" }}">{{ .Get "text" }}</abbr>

View File

@ -0,0 +1,80 @@
<!-- Author: Parsia Hakimian https://github.com/parsiya/Hugo-Shortcodes -->
<!-- port of Octopress blockquote plugin http://octopress.org/docs/plugins/blockquote/ to Hugo
see readme for usage -->
<!-- Adapted by iGor milhit for his own purpose -->
<!-- reset scratch variables at the start -->
{{ $.Scratch.Set "bl_lang" false }}
{{ $.Scratch.Set "bl_author" false }}
{{ $.Scratch.Set "bl_source" false }}
{{ $.Scratch.Set "bl_link" false }}
{{ $.Scratch.Set "bl_title" false }}
{{ if .IsNamedParams }}
{{ $.Scratch.Set "bl_lang" (.Get "lang") }}
{{ $.Scratch.Set "bl_author" (.Get "author") }}
{{ $.Scratch.Set "bl_source" (.Get "source") }}
{{ $.Scratch.Set "bl_link" (.Get "link") }}
{{ $.Scratch.Set "bl_title" (.Get "title") }}
{{ else }}
<!-- for the positional version if any -->
{{ end }}
<!-- if title is not set explicitly then we need to beautify the link
if length of link is more than 32 chars, we will cut it off by 32 and
then drop everything after the last / if any and put it in into title -->
{{ with $.Scratch.Get "bl_title" }}
<!-- do nothing -->
{{ else }}
{{ with $.Scratch.Get "bl_link" }} <!-- if link is given -->
{{ range last 1 (split ($.Scratch.Get "bl_link" ) "://") }} <!-- split by :// and then only take the items after it to remove protocol:// -->
{{ $.Scratch.Set "title_without_protocol" . }}
{{ end }}
{{ range last 1 (split ($.Scratch.Get "title_without_protocol" ) "www.") }} <!-- also remove the www. at the start if any. we are using a second split because all URLS may not start with it -->
{{ $.Scratch.Set "title_without_protocol" . }}
{{ end }}
{{ $.Scratch.Set "bl_title" ($.Scratch.Get "title_without_protocol") }}
<!-- if link is longer than 32 bytes we should trim it -->
{{ if (gt (len ($.Scratch.Get "title_without_protocol") ) 32) }}
{{ $title := (slicestr ($.Scratch.Get "title_without_protocol") 0 32) }} <!-- get the first 32 characters of title_without_protocol -->
{{ $split_by_fw_slash := split $title "/" }} <!-- now split on / because we want to stop after the last forward slash -->
{{ $count := (sub (len $split_by_fw_slash) 1) }} <!-- we want everything but the last part so we adjust the count accordingly -->
{{ $.Scratch.Set "tempstring" "" }} <!-- temp variable to hold the concatinated string -->
{{ range first $count $split_by_fw_slash }} <!-- loop through all parts except last and concat them (add / between halves) -->
{{ $.Scratch.Set "tempstring" ( . | printf "%s%s/" ($.Scratch.Get "tempstring") | printf "%s" ) }}
{{ end }}
{{ $.Scratch.Set "bl_title" ( printf "%s..." ($.Scratch.Get "tempstring") | printf "%s" ) }}
{{ end }}
{{ end }}
{{ end }}
<figure class="citation">
<blockquote
{{- with $.Scratch.Get "bl_lang" }} lang="{{ . }}"{{ end -}}
{{- with $.Scratch.Get "bl_link" }} cite="{{ . }}"{{ end -}}>
{{ .Inner | markdownify | safeHTML -}}
{{ with $.Scratch.Get "bl_author" -}}
<figcaption>
{{ with $.Scratch.Get "bl_author" -}}{{ . }}{{ end }}
{{ with $.Scratch.Get "bl_source" }}
&mdash; <cite>{{ . }}</cite>
{{ else }}
{{ with $.Scratch.Get "bl_link" }}
&mdash; <cite>
<a href="{{ . }}" title="{{ . }}" rel="noopener noreferrer">{{ $.Scratch.Get "bl_title" }}</a> <!-- can't have new lines here -->
</cite>
{{ else }}
{{ with $.Scratch.Get "bl_title" }}
&mdash; <cite>
{{ $.Scratch.Get "bl_title" }}</a>
</cite>
{{ end }}
{{ end }}
{{ end }}
</figcaption>
{{- end -}}
</blockquote>
</figure>

View File

@ -0,0 +1,16 @@
const url = 'https://id-libre.org/live/status-json.xsl';
const statusElement = document.getElementById('on');
async function status() {
const response = await fetch(url);
const data = await response.json();
const status = data.icestats.source ? 'on' : 'off'
statusElement.innerHTML = status;
statusElement.classList.remove("on", "off");
statusElement.classList.add(status);
}
status();
setInterval(() => status(), 2000);