From 79b3aac8a400e1b930c4bfc8645d229b01cbcddb Mon Sep 17 00:00:00 2001
From: Erik Winter
Date: Sat, 11 Jan 2025 15:25:33 +0100
Subject: [PATCH] code block experiments
---
ewintr.nl/config.toml | 5 +++
ewintr.nl/content/2020/_index.md | 2 +-
ewintr.nl/content/2021/_index.md | 2 +-
ewintr.nl/content/2022/_index.md | 2 +-
ewintr.nl/content/2023/_index.md | 2 +-
ewintr.nl/content/2024/_index.md | 2 +-
...ible-media-player-with-physical-buttons.md | 31 ++++++++++++++-----
...t50-and-other-configuration-shenanigans.md | 4 +++
ewintr.nl/content/2025/_index.md | 2 +-
.../themes/no-style-please/sass/style.scss | 6 ++--
.../no-style-please/templates/index.html | 25 +++++++--------
.../no-style-please/templates/page.html | 3 +-
.../templates/shortcodes/details.html | 6 ++++
13 files changed, 61 insertions(+), 31 deletions(-)
create mode 100644 ewintr.nl/themes/no-style-please/templates/shortcodes/details.html
diff --git a/ewintr.nl/config.toml b/ewintr.nl/config.toml
index 24acf0a..3b2b747 100644
--- a/ewintr.nl/config.toml
+++ b/ewintr.nl/config.toml
@@ -19,3 +19,8 @@ highlight_theme = "charcoal"
[extra]
# Put all your custom variables here
list_pages = true
+
+header_nav = [
+ { name = "home", url = "/" },
+ { name = "about", url = "/" },
+]
diff --git a/ewintr.nl/content/2020/_index.md b/ewintr.nl/content/2020/_index.md
index 9fb6820..6d9e43a 100644
--- a/ewintr.nl/content/2020/_index.md
+++ b/ewintr.nl/content/2020/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2020"
+++
diff --git a/ewintr.nl/content/2021/_index.md b/ewintr.nl/content/2021/_index.md
index 9fb6820..056d999 100644
--- a/ewintr.nl/content/2021/_index.md
+++ b/ewintr.nl/content/2021/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2021"
+++
diff --git a/ewintr.nl/content/2022/_index.md b/ewintr.nl/content/2022/_index.md
index 9fb6820..cc234bc 100644
--- a/ewintr.nl/content/2022/_index.md
+++ b/ewintr.nl/content/2022/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2022"
+++
diff --git a/ewintr.nl/content/2023/_index.md b/ewintr.nl/content/2023/_index.md
index 9fb6820..7278641 100644
--- a/ewintr.nl/content/2023/_index.md
+++ b/ewintr.nl/content/2023/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2023"
+++
diff --git a/ewintr.nl/content/2024/_index.md b/ewintr.nl/content/2024/_index.md
index 9fb6820..8d0b170 100644
--- a/ewintr.nl/content/2024/_index.md
+++ b/ewintr.nl/content/2024/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2024"
+++
diff --git a/ewintr.nl/content/2024/an-invisible-media-player-with-physical-buttons.md b/ewintr.nl/content/2024/an-invisible-media-player-with-physical-buttons.md
index 041e5c1..60b34a2 100644
--- a/ewintr.nl/content/2024/an-invisible-media-player-with-physical-buttons.md
+++ b/ewintr.nl/content/2024/an-invisible-media-player-with-physical-buttons.md
@@ -38,7 +38,7 @@ To make it work, I used the following:
Squeezelite is a straightforward player. Just start it with two arguments:
```bash
-squeezelite -n Toren -z
+$ squeezelite -n Toren -z
```
'Toren' is the name of the player here. It is Dutch for 'tower', this is my big computer. `-z` lets it run as a background daemon.
@@ -66,7 +66,9 @@ One special case needs to be added, though. If you start up the player for the f
We can check for the current length of the queue and issue the command if it is zero. Otherwise, execute pause/play on the media player:
-```yaml
+---
+
+{% details(summary="Click to view a yaml example of the automation") %}
alias: Pause/Play on Squeezelite Toren
description: ""
triggers:
@@ -97,7 +99,9 @@ actions:
target:
device_id: xxx
mode: single
-```
+{% end %}
+
+---
## The Cinnamon applet
@@ -106,11 +110,13 @@ Now, the applet is the most difficult part. There should not be a player window
Homeassistant has a REST API that provides all the information. Here is a `curl` command that fetches the information of my player:
```bash
-curl -X GET -H "Authorization: Bearer ${HA_TOKEN}" https://homeassistant.local:8123/api/states/media_player.squeezelite_toren | jq .
+$ curl -X GET -H "Authorization: Bearer ${HA_TOKEN}" https://homeassistant.local:8123/api/states/media_player.squeezelite_toren | jq .
```
Which returns something like this:
+---
+
```bash
{
"entity_id": "media_player.squeezelite_toren
@@ -146,6 +152,8 @@ Which returns something like this:
}
```
+---
+
As one can see, one needs to [create an API token](https://developers.home-assistant.io/docs/api/rest/) to access the REST API of Homeassistant. Our applet will use the same method.
### The actual applet
@@ -172,8 +180,9 @@ This folder will need three files:
This is the metadata that helps Cinnamon understand the applet.
+---
+
```json
-// metadata.json
{
"uuid": "currentlyplaying@ewintr",
"name": "Currently playing",
@@ -183,12 +192,15 @@ This is the metadata that helps Cinnamon understand the applet.
}
```
+---
+
### settings-schema.json
This enables a form where the user of the applet can enter their Homeassistant API key.
+---
+
```json
-// settings-schema.json
{
"ha_token": {
"type": "entry",
@@ -198,12 +210,15 @@ This enables a form where the user of the applet can enter their Homeassistant A
}
```
+---
+
### applet.js
A Javascript snippets that polls the Homeassistant API about the status of the media player and displays the band and song when playing.
+---
+
```javascript
-// applet.js
const Applet = imports.ui.applet;
const Util = imports.misc.util;
const Mainloop = imports.mainloop;
@@ -258,4 +273,6 @@ function main(metadata, orientation, panelHeight, instance_id) {
}
```
+---
+
And there you have it: plenty of moving parts, but on the surface it quietly just works.
diff --git a/ewintr.nl/content/2024/forwarding-https-on-a-zyxel-vmg8825-t50-and-other-configuration-shenanigans.md b/ewintr.nl/content/2024/forwarding-https-on-a-zyxel-vmg8825-t50-and-other-configuration-shenanigans.md
index 28a7da0..3d97464 100644
--- a/ewintr.nl/content/2024/forwarding-https-on-a-zyxel-vmg8825-t50-and-other-configuration-shenanigans.md
+++ b/ewintr.nl/content/2024/forwarding-https-on-a-zyxel-vmg8825-t50-and-other-configuration-shenanigans.md
@@ -25,6 +25,8 @@ What to do? On the page is a piece of JavaScript that is very eager to move you
And then I figured that the script would probably not be very sophisticated. It would likely just look at the protocol, not the host or the whole URL. So I asked an AI to generate a nginx configuration snippet that would let nginx function as an HTTPS proxy with a self-signed certificate:
+---
+
```nginx
server {
listen 443 ssl http2 default_server;
@@ -60,6 +62,8 @@ server {
}
```
+---
+
Now if I want to access the configuration of my Zyxel:
- Disable the normal default site and enable the one above
diff --git a/ewintr.nl/content/2025/_index.md b/ewintr.nl/content/2025/_index.md
index 9fb6820..71f0bd1 100644
--- a/ewintr.nl/content/2025/_index.md
+++ b/ewintr.nl/content/2025/_index.md
@@ -1,3 +1,3 @@
+++
-transparent = true
+title = "2025"
+++
diff --git a/ewintr.nl/themes/no-style-please/sass/style.scss b/ewintr.nl/themes/no-style-please/sass/style.scss
index ee011b3..0e06ee3 100644
--- a/ewintr.nl/themes/no-style-please/sass/style.scss
+++ b/ewintr.nl/themes/no-style-please/sass/style.scss
@@ -51,6 +51,7 @@ li { margin: 0.4rem 0; }
padding: 4rem 2rem;
}
+/*
hr {
text-align: center;
border: 0;
@@ -58,6 +59,7 @@ hr {
&:before { content: '/////' }
&:after { content: attr(data-content) '/////' }
}
+*/
table { width: 100%; }
@@ -77,8 +79,8 @@ code {
pre code {
display: block;
overflow-x: auto;
- //white-space: pre-wrap;
- padding: 1rem;
+ white-space: pre-wrap;
+ //padding: 1rem;
}
blockquote {
diff --git a/ewintr.nl/themes/no-style-please/templates/index.html b/ewintr.nl/themes/no-style-please/templates/index.html
index 9fa741a..e33b069 100644
--- a/ewintr.nl/themes/no-style-please/templates/index.html
+++ b/ewintr.nl/themes/no-style-please/templates/index.html
@@ -3,23 +3,20 @@
{% block content %}
{{ section.content | safe }}
-{% if config.extra.list_pages %}
-{% if paginator %}
-{% set pages = paginator.pages | sort(attribute="date") | reverse %}
-{% else %}
-{% set pages = section.pages | sort(attribute="date") | reverse %}
-{% endif %}
-
-{% for page in pages %}
+{% set section = get_section(path="_index.md") %}
+{% set subsections = section.subsections | sort | reverse %}
+{% for s in subsections %}
+ {% set ss = get_section(path=s) %}
+