]> danix's work - danix.xyz-2.git/commitdiff
consolidated duplicated shortcodes. Initial fix of the content files. Manual review...
authorDanilo M. <redacted>
Sat, 18 Apr 2026 16:19:47 +0000 (18:19 +0200)
committerDanilo M. <redacted>
Sat, 18 Apr 2026 16:19:47 +0000 (18:19 +0200)
18 files changed:
SHORTCODES.md
TODO.md
content/en/articles/cad-designing-in-gnu-linux/index.md
content/en/articles/gify-back-to-bash-scripting/index.md
content/en/articles/git-setup-own-server/index.md
content/en/articles/imagine/index.md
content/en/articles/katsushika-hokusai/index.md
content/en/articles/le-email-queste-sconosciute/index.md
content/en/articles/nerdness/index.md
content/en/articles/playing-with-colors/index.md
content/en/articles/sunset-in-siderno/index.md
themes/danix-xyz-hacker/assets/css/main.min.css
themes/danix-xyz-hacker/layouts/shortcodes/figure.html [deleted file]
themes/danix-xyz-hacker/layouts/shortcodes/gal-img.html [deleted file]
themes/danix-xyz-hacker/layouts/shortcodes/image.html
themes/danix-xyz-hacker/layouts/shortcodes/img.html [deleted file]
themes/danix-xyz-hacker/layouts/shortcodes/video.html
themes/danix-xyz-hacker/layouts/shortcodes/youtube.html [deleted file]

index fdfec6f8de1d036f1cc335a1906b3fd870dded6e..a7e86c87e87b1f78496c383376fc6723bd109c7f 100644 (file)
@@ -47,10 +47,12 @@ Display a responsive image with optional caption and automatic lazy-loading. Ima
 
 | Parameter | Required | Description |
 |-----------|----------|-------------|
-| src | Yes | Path or URL to the image file |
-| alt | No | Alt text for accessibility |
+| src | Conditional | Path or URL to the image file (required unless inner content is provided) |
+| alt | No | Alt text for accessibility (default: "Image") |
 | caption | No | Optional caption displayed below the image |
-| class | No | Custom CSS classes (default: "w-full h-auto rounded-lg border border-border/30"). Overrides all defaults when specified. |
+| class | No | CSS classes for the `<img>` element (default: "w-full h-auto rounded-lg border border-border"). Overrides all defaults when specified. |
+| link | No | URL to wrap the image in a clickable link |
+| figure-class | No | CSS classes applied to the outer `<figure>` element (e.g., for centering or custom layout) |
 
 ### Example
 
@@ -69,6 +71,16 @@ With custom sizing and styling:
 {{< image src="/images/mountain.jpg" alt="Mountain landscape" class="w-2/3 mx-auto rounded-lg shadow-lg border-2 border-accent" >}}
 ```
 
+With link:
+```
+{{< image src="/images/mountain.jpg" alt="Mountain landscape" link="https://github.com/example" caption="Click to view project" >}}
+```
+
+Centered image with figure-class:
+```
+{{< image src="/images/mountain.jpg" alt="Mountain landscape" caption="Alpine view" figure-class="text-center" >}}
+```
+
 ### Common CSS Classes for Image Sizing
 
 Use Tailwind CSS utility classes to customize image appearance:
@@ -175,13 +187,15 @@ Embed responsive HTML5 video player with support for WebM, MP4, and other web vi
 
 | Parameter | Required | Description |
 |-----------|----------|-------------|
-| src | Yes | Path or URL to the video file (supports .webm, .mp4, .ogv) |
-| width | No | Video width (default: 100%, can be px or % values) |
-| height | No | Video height (default: auto) |
+| src | Conditional | Path or URL to the video file (required if `id` is not provided; supports .webm, .mp4, .ogv) |
+| id | Conditional | YouTube video ID (required if `src` is not provided; triggers YouTube embed mode) |
+| title | No | Descriptive title for accessibility (default: "Video"; used as iframe title attribute) |
+| width | No | Video width (default: 100%, can be px or % values; video mode only) |
+| height | No | Video height (default: auto; video mode only) |
 | class | No | Custom CSS classes for styling |
-| autoplay | No | Set to "true" to autoplay (default: false) |
-| loop | No | Set to "true" for looping playback (default: false) |
-| muted | No | Set to "true" to mute by default (default: false) |
+| autoplay | No | Set to "true" to autoplay (default: false; video mode only) |
+| loop | No | Set to "true" for looping playback (default: false; video mode only) |
+| muted | No | Set to "true" to mute by default (default: false; video mode only) |
 
 ### Example
 
@@ -205,6 +219,16 @@ External video URL:
 {{< video src="https://example.com/video.mp4" width="100%" >}}
 ```
 
+YouTube embed (recommended for privacy and performance):
+```
+{{< video id="dQw4w9WgXcQ" title="Example YouTube video" >}}
+```
+
+YouTube with custom sizing:
+```
+{{< video id="dQw4w9WgXcQ" title="Example YouTube video" class="max-w-2xl mx-auto" >}}
+```
+
 ### Page Bundle Videos
 
 Videos stored in the same directory as your article's `index.md` are automatically resolved:
@@ -414,7 +438,25 @@ The following shortcodes are planned for future releases:
 - **Tabs**: Tabbed content sections for organizing related information
 - **Code**: Enhanced code blocks with syntax highlighting and line numbers
 - **Audio**: Audio player for podcast episodes and sound files
-- **YouTube/Vimeo**: Privacy-friendly embedded video players
+
+## Deprecated Shortcodes
+
+The following shortcodes have been consolidated and are no longer available:
+
+| Deprecated | Replacement | Migration |
+|-----------|------------|-----------|
+| `{{< figure >}}` | `{{< image >}}` | Use `{{< image >}}` with the `figure-class` parameter for styling the figure element |
+| `{{< img >}}` | `{{< image >}}` | Directly replace with `{{< image >}}` and add proper `alt` text |
+| `{{< gal-img >}}` | Markdown syntax inside `{{< gallery >}}` | Replace `{{< gal-img ... >}}` calls with standard markdown: `![alt](src)` |
+| `{{< youtube ID >}}` | `{{< video id="ID" >}}` | Change `{{< youtube ID >}}` to `{{< video id="ID" title="Description" >}}` |
+
+### Why These Changes?
+
+The consolidation reduces maintenance overhead and provides better functionality:
+- **`image` shortcode** now supports all image display modes with flexible parameters
+- **`video` shortcode** unifies local video and YouTube embeds in one interface
+- **`gallery` shortcode** uses standard markdown image syntax for better clarity
+- **WCAG AA compliance** improved with required `title` attributes on YouTube iframes
 
 ## Accessibility Notes
 
diff --git a/TODO.md b/TODO.md
index e76039bddaad16d102516a966bd82d43fe8bad27..9dec10e78178da1e444fc5f0c9a0a4362ab14cc6 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,10 +1,12 @@
 # danix.xyz Week 6+ TODO List
 
+- [ ] Content review (correct post type, fix thumbnails, metadata, etc.)
 - [✅] Related Articles widget in sidebar.
 - [✅] social sharing sidebar widget
 - [✅] titles redesign (mono font // Title)
 - [✅] Sidebar widgets redesign (no box, mono font "# Title")
 - [ ] Footer redesign (3-column, social badges, fortune cookie, tech badges, etc.)
+- [✅] related articles debug
 - [ ] shortcodes cleanup (remove duplicates)
 - [ ] Search functionality
 - [ ] Open Graph meta tags for social sharing
index cd65afe1573419e5738a49ee4f9ea0f50a15e309..2323b34c812b90e1c808fd46ed90a5a62c271d6f 100644 (file)
@@ -7,6 +7,7 @@ excerpt = ""
 image = "/uppies/2021/05/PXL_20210501_114542849.jpg"
 categories = ["3D Printing", "diy"]
 tags = ["3D printing", "cad", "cura", "fusion360", "slicer", "solvespace"]
+typora-root-url = "../../static"
 
 +++
 {{< quote source="semicit. Eminem" >}}
@@ -28,7 +29,7 @@ I&#8217;ve had it for a few months now and I&#8217;m pretty happy I purchased it
 
 The software you mainly use with a 3D printer is a slicer, which is a piece of software that takes a 3D rendering of the item you want to print and slice it into many layers, stacked one on top of the other, you can manipulate the layers in various ways in order to alter the properties of the final printed item.
 
-{{< image class="max-w-m mx-auto" caption="Ultimaker Cura 4.9 main interface" src="2021-04-25-183336_1366x768_scrot.png" alt="Screenshot from Ultimaker Cura 4.9 main interface" >}}
+{{< image class="max-w-md mx-auto" caption="Ultimaker Cura 4.9 main interface" src="/uppies/2021/05/2021-04-25-183336_1366x768_scrot.png" alt="Screenshot from Ultimaker Cura 4.9 main interface" >}}{{< /image >}}
 
 I&#8217;ve chosen [Ultimaker Cura](https://ultimaker.com/software/ultimaker-cura) as my main slicer, I started with it and I found it&#8217;s easy enough for a noob like me, but manages to give the user a lot of room for customization when you start understanding how it works.
 
@@ -50,11 +51,11 @@ Another very good reason for not using Fusion, is the fact that all of your file
 
 ## Meet SolveSpace
 
-{{< image class="max-w-m mx-auto" caption="solvespace interface" src="2021-04-25-190246_1366x768_scrot.png" alt="Screenshot from solvespace interface" >}}
+{{< image class="max-w-md mx-auto" caption="solvespace interface" src="/uppies/2021/05/2021-04-25-190246_1366x768_scrot.png" alt="Screenshot from solvespace interface" >}}{{< /image >}}
 
 [SolveSpace](https://solvespace.com/index.pl) is a 2D/3D parametric cad Software, it&#8217;s totally free, licensed under the GPLv3 and available for windows, mac and of course GNU/Linux.
 
-{{< video class="max-w-m mx-auto" autoplay="false" loop="false" src="/solvespace_demo.webm" alt="Solvespace video demo" >}}
+{{< video class="max-w-md mx-auto" src="/uppies/2021/05/solvespace_demo.webm" >}}
 
 I&#8217;ve watched this introductory video and was able to pick it up and start designing in a matter of minutes, it&#8217;s very straightforward and even if it does things a bit differently than Fusion, it&#8217;s still very comfortable to use.
 
index ee47220bfaa5180c996cb4a71940709a8b37db48..784189561be08c6829bbb526fb9532a09e5d9bdd 100644 (file)
@@ -7,7 +7,7 @@ image = "/uppies/2016/01/G0092546.jpg"
 categories = ["code", "diy", "fotografia"]
 tags = ["bash", "convert", "gif", "imagemagik", "mogrify", "script"]
 +++
-{{< image class="max-w-lg mx-auto" src="piscaturi.gif" alt="piccoli pescatori crescono" caption="gif image created using gify.sh" >}}
+{{< image class="max-w-lg mx-auto" src="/uppies/2016/01/piscaturi.gif" alt="piccoli pescatori crescono" caption="gif image created using gify.sh" >}}{{< /image >}}
 
 Today I'll present you a useful script that will help you create amazing gifs from your still photos using a couple tools from the [IMAGEMAGIK](https://www.imagemagick.org) suite, so without further ado, here it is, straight from github's gists.
 
index 0ba09c184a9e8f6720c0ea7318dea69ebced66ec..5fa9186afa4d378663d07157c09e9199f405410e 100644 (file)
@@ -32,12 +32,12 @@ Installing a git server is quite simple once you know how it works, on my server
 
 I've added a new user and group to my server but before doing so I added /usr/bin/git-shell to /etc/shells in order to use it as login shell for my git user.
 
-{{< highlight bash >}}
+```bash
 echo "/usr/bin/git-shell" >> /etc/shells
 groupadd git
 mkdir /var/git
 useradd -d /var/git -g git -M -s /usr/bin/git-shell
-{{< /highlight >}}
+```
 
 now the user is all set and ready to be used. Next step will be to create the .ssh directory and the authorized_keys file to hold the keys for the developers that have to access the git server. Here's how I did it:
 
index e1c6e69e190543ffa0fd100d0904e0f46b187814..eb357b1f19bad135c2ccda68c156ddf1c259bdf4 100644 (file)
@@ -8,7 +8,7 @@ categories = ["freedom", "musica"]
 tags = ["imagine", "john lennon"]
 format = "image"
 +++
-{{< figure class="align-center" src="https://danix.xyz/wp-content/uploads/2020/10/imagine_colors.jpg" />}}
+{{< image src="https://danix.xyz/wp-content/uploads/2020/10/imagine_colors.jpg" alt="Imagine by John Lennon as a comic strip" >}}{{< /image >}}
 
 via [http://www.filmsforaction.org/articles/john-lennons-imagine-made-into-a-comic-strip/](http://www.filmsforaction.org/articles/john-lennons-imagine-made-into-a-comic-strip/)
 
index af58658145588e843d01549b62c3595674fb12ad..1b0d96e0887f19d7a1d7ad08a10d16fb0ac54f8e 100644 (file)
@@ -17,20 +17,20 @@ I just wanted to share a few images by one of my favourite artists with you.
 
 Enjoy.
 
-{{< gallery >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Boy-on-Mount-Fuji-large.jpg" alt="Boy on Mount Fuji" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Choshi-in-Shimosa-Province-Soshu-Choshi-large.jpg" alt="Choshi in Shimosa Province" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Hibiscus-and-Sparrow-large.jpg" alt="Hibiscus and Sparrow" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Mt.-Fuji-in-the-Sunset-large.jpg" alt="Mt. Fuji in the Sunset" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Yoro-Waterfall-in-Mino-Province-Mino-no-kuni-Yoro-no-taki-large.jpg" alt="Yoro Waterfall in Mino Province Mino no kuni Yoro no taki" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/White-Shell-Shiragai-large.jpg" alt="White Shell Shiragai" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Waterfall-where-Yoshitsune-Washed-his-Horse-at-Yoshino-in-Yamato-Province-Washu-Yoshino-Yoshitsune-uma-arai-no-taki-large.jpg" alt="Waterfall where Yoshitsune Washed his Horse at Yoshino in Yamato Province Washu Yoshino Yoshitsune uma arai no taki" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/The-Great-Wave-Off-Kanagawa-1823-large.jpg" alt="The Great Wave Off Kanagawa" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/The-dragon-on-Smoke-Escaping-from-Mt-Fuji-large.jpg" alt="The dragon on Smoke Escaping from Mt Fuji" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Surimono-Totsuka-large.jpg" alt="Surimono Totsuka" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/South-Wind-at-Clear-Dawn-Gaifu-kaisei-large.jpg" alt="South Wind at Clear Dawn Gaifu kaisei" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Shower-Below-the-Summit-Sanka-hakuu-large.jpg" alt="Shower Below the Summit Sanka hakuu" >}}
-  {{< gal-img divClass="col-3 gtr-uniform" src="/uploads/2011/07/Plum-Blossom-and-the-Moon-large.jpg" alt="Plum Blossom and the Moon" >}}
+{{< gallery cols="3" >}}
+![Boy on Mount Fuji](/uploads/2011/07/Boy-on-Mount-Fuji-large.jpg)
+![Choshi in Shimosa Province](/uploads/2011/07/Choshi-in-Shimosa-Province-Soshu-Choshi-large.jpg)
+![Hibiscus and Sparrow](/uploads/2011/07/Hibiscus-and-Sparrow-large.jpg)
+![Mt. Fuji in the Sunset](/uploads/2011/07/Mt.-Fuji-in-the-Sunset-large.jpg)
+![Yoro Waterfall in Mino Province](/uploads/2011/07/Yoro-Waterfall-in-Mino-Province-Mino-no-kuni-Yoro-no-taki-large.jpg)
+![White Shell Shiragai](/uploads/2011/07/White-Shell-Shiragai-large.jpg)
+![Waterfall where Yoshitsune Washed his Horse](/uploads/2011/07/Waterfall-where-Yoshitsune-Washed-his-Horse-at-Yoshino-in-Yamato-Province-Washu-Yoshino-Yoshitsune-uma-arai-no-taki-large.jpg)
+![The Great Wave Off Kanagawa](/uploads/2011/07/The-Great-Wave-Off-Kanagawa-1823-large.jpg)
+![The dragon on Smoke Escaping from Mt Fuji](/uploads/2011/07/The-dragon-on-Smoke-Escaping-from-Mt-Fuji-large.jpg)
+![Surimono Totsuka](/uploads/2011/07/Surimono-Totsuka-large.jpg)
+![South Wind at Clear Dawn](/uploads/2011/07/South-Wind-at-Clear-Dawn-Gaifu-kaisei-large.jpg)
+![Shower Below the Summit](/uploads/2011/07/Shower-Below-the-Summit-Sanka-hakuu-large.jpg)
+![Plum Blossom and the Moon](/uploads/2011/07/Plum-Blossom-and-the-Moon-large.jpg)
 {{< /gallery >}}
 
 I hope you liked them. I'll see you on the next one.
index 556b6975bbf8997b08567319cb381f44e8a9747b..8fd5231e2468447e468392c1b1f039e0e6582f0d 100644 (file)
@@ -12,7 +12,7 @@ Prendo spunto da un simpatico quanto tristemente reale [articolo pubblicato][1]
 
 <!--more-->
 
-{{< figure src="/uploads/2010/11/email-at1-300x211.gif" class="align-left" />}}
+{{< image src="/uploads/2010/11/email-at1-300x211.gif" alt="Email at symbol illustration" >}}{{< /image >}}
 Già vi immagino, voi fedeli (3) lettori, subito pronti a dire: "_ma cosa vorrai mai insegnarci sulle email che già non sappiamo?_" beh, iniziamo dalla prima cosa che colpisce l'occhio di chi riceve una mail, l'**oggetto**.
 
 Eh già, si chiama oggetto perchè serve a descrivere ciò di cui l'email parla, l'oggetto del messaggio appunto. Non ha quindi senso lasciare il campo in bianco o scrivere cose senza senso tipo "email da tizio:, "comunicazione da sempronio: eccetera, per sapere chi è il mittente dell'email c'è il campo "From: o "Da: oppure indovinate un po', "Mittente:, l'avreste mai detto?! :)
@@ -21,7 +21,7 @@ Un'altra cosa piuttosto bruttina da vedere è il corpo del messaggio vuoto con t
 
 Un altro problema che affligge spesso chi riceve email è l'invio di foto! Su questo punto potremmo spendere fiumi di parole parlando del fatto che al giorno d'oggi con le adsl super veloci che ci ritroviamo non sia più un problema ricevere allegati pesanti, ma non capisco perchè io debba stare a scaricare una foto da 12 megapixel a 300 <acronym title="dot per inches (punti per pollice)">dpi</acronym> se non dovrò nemmeno stamparla, ma al massimo condividerla sul blog o su facebook; perdete un attimino del vostro <span style="text-decoration: line-through">prezioso</span> tempo anche voi e riducete le dimensioni delle foto che inviate, già ridurre la risoluzione da 300 a 72 [dpi][4] aiuterà notevolmente chi dovrà ricevere la mail oltre che farvi risparmiare molto tempo in invio.. Un altro appunto relativo alle dimensioni delle foto, se state mandando una foto di un tenero cucciolo che dovrà fare da sfondo al piccì del vostro/a amato/a, che senso ha che misuri 4000 pixel sul lato corto?! Una risoluzione decente potrebbe essere 1600 pixel sul lato lungo e il lato corto dimensionato in proporzione, in questo modo le dimensioni scenderanno ulteriormente senza che si perda la qualità del vostro pregevolissimo scatto! ;)
 
-{{< figure class="align-right" src="/uploads/2010/11/url-300x197.jpg" />}}
+{{< image src="/uploads/2010/11/url-300x197.jpg" alt="URL structure illustration" >}}{{< /image >}}
 [5]Il punto successivo di questa carrellata potrebbe avere un titolo e un articolo a se, "_come inviare link. Il modo corretto di condividere i famigerati [URL][6]_"; fin dagli albori di internet si è avvertita infatti la necessità di condividere link interessanti con i nostri contatti, e sopratutto negli ultimi tempi i link sono diventati sempre più lunghi e complessi, cose tipo:
 
 ```
index c1312b1b22631c347295efc04862b904e916412c..80623cb5cc7461c8a2f044f4c1e0b176b288ff98 100644 (file)
@@ -7,9 +7,7 @@ excerpt = "We are nerds, Resistance is futile"
 categories = ["blogging"]
 tags = ["john green", "nerds"]
 +++
-{{< figure class="align-center" caption="We are nerds. Resistance is futile" >}}
-{{< img src="/uploads/2011/08/nerdslikeus.png" alt="nerds like us" >}}
-{{< /figure >}}
+{{< image src="/uploads/2011/08/nerdslikeus.png" alt="nerds like us" caption="We are nerds. Resistance is futile" figure-class="text-center" >}}{{< /image >}}
 
 
 via [ipstenu.org][1]
index 9a1108900b19a3ca851fe243916f0680eeeb739a..d4477905224a161e68deca0db2c9453095fe26a2 100644 (file)
@@ -7,7 +7,7 @@ image = "/uppies/2016/02/palette.jpg"
 categories = ["code", "diy"]
 tags = ["colors", "github", "html5", "palette", "php", "viewer"]
 +++
-{{< figure src="https://danix.xyz/wp-content/uploads/2016/02/palette-1.jpg" class="image fit" link="https://github.com/danixland/palette-viewer" caption="palette-viewer on github" />}}
+{{< image src="https://danix.xyz/wp-content/uploads/2016/02/palette-1.jpg" alt="palette-viewer screenshot" link="https://github.com/danixland/palette-viewer" caption="palette-viewer on github" >}}{{< /image >}}
 
 {{< dropcap >}}
 Today I decided I wanted to have a little "old school" fun, so instead of working on some WordPress theme/plugin, I went for the "lemme write some php from scratch" approach.
index daa312fa1c6d0ace079ed2ccd2b81c00ffe04354..e59bd47b1628b28a3d239dead54be2b295842d62 100644 (file)
@@ -9,7 +9,7 @@ tags = ["gopro", "kdenlive", "siderno", "sunset", "timelapse", "youtube"]
 format = "video"
 +++
 
-{{< youtube ku9JVNK6rLU >}}
+{{< video id="ku9JVNK6rLU" title="Sunset in Siderno - GoPro timelapse" >}}
 
 my first video, an experiment with a GoPro Hero+ LCD and Kdenlive.
 
index fecb6d1b44f417ed8c670d514f9a1bd6a3ef3316..9ce65bf5baef37f90deca5e5d55043ce05c0354e 100644 (file)
@@ -1747,11 +1747,6 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   margin-bottom: 3rem;
 }
 
-.my-4 {
-  margin-top: 1rem;
-  margin-bottom: 1rem;
-}
-
 .my-6 {
   margin-top: 1.5rem;
   margin-bottom: 1.5rem;
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/figure.html b/themes/danix-xyz-hacker/layouts/shortcodes/figure.html
deleted file mode 100644 (file)
index 27d6cb2..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{{- $src := .Get "src" -}}
-{{- $alt := .Get "alt" -}}
-{{- $class := .Get "class" -}}
-<figure class="my-6 {{ $class }}">
-  {{- if $src -}}<img src="{{ $src }}" alt="{{ $alt }}" class="w-full" />{{ end -}}
-  {{- .Inner -}}
-  {{- if .Get "caption" -}}<figcaption class="text-sm text-text-dim mt-2">{{ .Get "caption" }}</figcaption>{{ end -}}
-</figure>
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/gal-img.html b/themes/danix-xyz-hacker/layouts/shortcodes/gal-img.html
deleted file mode 100644 (file)
index b9f8098..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="{{ .Get "divClass" }}">
-  <img src="{{ .Get "src" }}" alt="{{ .Get "alt" }}" class="image fit" />
-</div>
index 0209b7e6f40bc4f350994c827724d65f1ccb61ba..84dec3ff9f630c1eb84ac67feec0cf0f17aed3ce 100644 (file)
@@ -1,22 +1,23 @@
 {{- $src := .Get "src" -}}
 {{- $alt := .Get "alt" | default "Image" -}}
 {{- $caption := .Get "caption" -}}
-{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border/30" -}}
+{{- $class := .Get "class" | default "w-full h-auto rounded-lg border border-border" -}}
+{{- $link := .Get "link" -}}
+{{- $figureClass := .Get "figure-class" -}}
 
-{{- if $src -}}
-  <figure class="my-8">
-    <img
-      src="{{ $src }}"
-      alt="{{ $alt }}"
-      class="{{ $class }}"
-      loading="lazy"
-    />
+{{- if or $src .Inner -}}
+  <figure class="my-8{{- with $figureClass }} {{ . }}{{- end -}}">
+    {{- if .Inner -}}
+      {{- .Inner -}}
+    {{- else -}}
+      {{- if $link -}}<a href="{{ $link }}">{{- end -}}
+      <img src="{{ $src }}" alt="{{ $alt }}" class="{{ $class }}" loading="lazy" />
+      {{- if $link -}}</a>{{- end -}}
+    {{- end -}}
     {{- if $caption -}}
-      <figcaption class="mt-3 text-center text-sm text-text-dim italic">
-        {{ $caption }}
-      </figcaption>
+      <figcaption class="mt-3 text-center text-sm text-text-dim italic">{{ $caption }}</figcaption>
     {{- end -}}
   </figure>
 {{- else -}}
-  {{- errorf "image shortcode: 'src' parameter is required" -}}
+  {{- errorf "image shortcode: 'src' parameter or inner content is required" -}}
 {{- end -}}
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/img.html b/themes/danix-xyz-hacker/layouts/shortcodes/img.html
deleted file mode 100644 (file)
index 2393928..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<img src="{{ .Get "src" }}" alt="{{ .Get "alt" }}" class="w-full my-4" />
index a07500ac412db9574179ea769d4d5288e3aeb55e..1e2645d7533e2e1a72cf8712aff6fcbc3051f14c 100644 (file)
@@ -1,43 +1,37 @@
-{{/*
-       * The video shortcode:
-       * All arguments are optional, except for src which is where you define your video file
-       * This shortcode supports only webm video files.
-       * Args:
-       *               class: [string] The class(es) to give to the video block.
-       *               width: [int] The width of the video
-       *               height: [int] The height of the video
-       *               autoplay: [bool] true or false for autoplay - defaults to false
-       *               loop: [bool] true or false for loop - defaults to false
-       *               mute: [bool] true or false for mute - defaults to false
-       *
-       * Usage:
-       *               {{< video src="my-awesome-video.mp4" width=600 height=600 autoplay=true loop=true mute=true class="some class" >}}
-       *
-       * Output:
-       *       <video class="some class" controls preload="auto" width="600" height="600" autoplay loop muted>
-                       <source src="my-awesome-video.mp4" type="video/webm">
-       *       </video>
-       *
-       */}}
+{{- $src := .Get "src" -}}
+{{- $id := .Get "id" -}}
+{{- $title := .Get "title" | default "Video" -}}
+{{- $class := .Get "class" | default "" -}}
 
-{{ $srcParam := .Get "src" }}
-{{ $ext := $srcParam | path.Ext }}
-{{ $filetype := slicestr $ext 1 }}
-
-{{ $videoURL := $srcParam }}
-{{ $resource := .Page.Resources.GetMatch $srcParam }}
-{{ if $resource }}
-  {{ $videoURL = $resource.RelPermalink }}
-{{ end }}
-
-<video{{ with .Get "class" }} class="{{ . }}"{{ end }}
-       controls
-       preload="auto"
-       {{ with .Get "width" }}width="{{.}}"{{ end }}
-       {{ with .Get "height" }}height="{{.}}"{{ end }}
-       {{ if eq (.Get "autoplay") "true" }}autoplay {{ end }}
-       {{ if eq (.Get "loop") "true" }}loop {{ end }}
-       {{ if eq (.Get "muted") "true" }}muted {{ end }}
-       playsinline >
+{{- if $id -}}
+  <div class="my-6{{- with $class }} {{ . }}{{- end -}}">
+    <iframe
+      class="w-full aspect-video"
+      src="https://www.youtube.com/embed/{{ $id }}"
+      title="{{ $title }}"
+      allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+      allowfullscreen
+    ></iframe>
+  </div>
+{{- else if $src -}}
+  {{- $ext := $src | path.Ext -}}
+  {{- $filetype := slicestr $ext 1 -}}
+  {{- $videoURL := $src -}}
+  {{- $resource := .Page.Resources.GetMatch $src -}}
+  {{- if $resource -}}{{- $videoURL = $resource.RelPermalink -}}{{- end -}}
+  <video
+    {{- with $class }} class="{{ . }}"{{ end }}
+    controls
+    preload="auto"
+    playsinline
+    {{- with .Get "width" }} width="{{ . }}"{{ end }}
+    {{- with .Get "height" }} height="{{ . }}"{{ end }}
+    {{- if eq (.Get "autoplay") "true" }} autoplay{{ end }}
+    {{- if eq (.Get "loop") "true" }} loop{{ end }}
+    {{- if eq (.Get "muted") "true" }} muted{{ end }}
+  >
     <source src="{{ $videoURL }}" type="video/{{ $filetype }}">
-</video>
+  </video>
+{{- else -}}
+  {{- errorf "video shortcode: either 'src' or 'id' parameter is required" -}}
+{{- end -}}
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/youtube.html b/themes/danix-xyz-hacker/layouts/shortcodes/youtube.html
deleted file mode 100644 (file)
index 80cbb93..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<iframe class="w-full aspect-video my-6" src="https://www.youtube.com/embed/{{ .Get "id" }}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>