From: Danilo M. Date: Sat, 18 Apr 2026 16:19:47 +0000 (+0200) Subject: consolidated duplicated shortcodes. Initial fix of the content files. Manual review... X-Git-Tag: release_22042026-1342~94 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=46779476a570346661a2741607265caed42829b2;p=danix.xyz-2.git consolidated duplicated shortcodes. Initial fix of the content files. Manual review needed --- diff --git a/SHORTCODES.md b/SHORTCODES.md index fdfec6f..a7e86c8 100644 --- a/SHORTCODES.md +++ b/SHORTCODES.md @@ -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 `` 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 `
` 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 e76039b..9dec10e 100644 --- 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 diff --git a/content/en/articles/cad-designing-in-gnu-linux/index.md b/content/en/articles/cad-designing-in-gnu-linux/index.md index cd65afe..2323b34 100644 --- a/content/en/articles/cad-designing-in-gnu-linux/index.md +++ b/content/en/articles/cad-designing-in-gnu-linux/index.md @@ -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’ve had it for a few months now and I’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’ve chosen [Ultimaker Cura](https://ultimaker.com/software/ultimaker-cura) as my main slicer, I started with it and I found it’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’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’ve watched this introductory video and was able to pick it up and start designing in a matter of minutes, it’s very straightforward and even if it does things a bit differently than Fusion, it’s still very comfortable to use. diff --git a/content/en/articles/gify-back-to-bash-scripting/index.md b/content/en/articles/gify-back-to-bash-scripting/index.md index ee47220..7841895 100644 --- a/content/en/articles/gify-back-to-bash-scripting/index.md +++ b/content/en/articles/gify-back-to-bash-scripting/index.md @@ -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. diff --git a/content/en/articles/git-setup-own-server/index.md b/content/en/articles/git-setup-own-server/index.md index 0ba09c1..5fa9186 100644 --- a/content/en/articles/git-setup-own-server/index.md +++ b/content/en/articles/git-setup-own-server/index.md @@ -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: diff --git a/content/en/articles/imagine/index.md b/content/en/articles/imagine/index.md index e1c6e69..eb357b1 100644 --- a/content/en/articles/imagine/index.md +++ b/content/en/articles/imagine/index.md @@ -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/) diff --git a/content/en/articles/katsushika-hokusai/index.md b/content/en/articles/katsushika-hokusai/index.md index af58658..1b0d96e 100644 --- a/content/en/articles/katsushika-hokusai/index.md +++ b/content/en/articles/katsushika-hokusai/index.md @@ -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. diff --git a/content/en/articles/le-email-queste-sconosciute/index.md b/content/en/articles/le-email-queste-sconosciute/index.md index 556b697..8fd5231 100644 --- a/content/en/articles/le-email-queste-sconosciute/index.md +++ b/content/en/articles/le-email-queste-sconosciute/index.md @@ -12,7 +12,7 @@ Prendo spunto da un simpatico quanto tristemente reale [articolo pubblicato][1] -{{< 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 dpi se non dovrò nemmeno stamparla, ma al massimo condividerla sul blog o su facebook; perdete un attimino del vostro prezioso 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: ``` diff --git a/content/en/articles/nerdness/index.md b/content/en/articles/nerdness/index.md index c1312b1..80623cb 100644 --- a/content/en/articles/nerdness/index.md +++ b/content/en/articles/nerdness/index.md @@ -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] diff --git a/content/en/articles/playing-with-colors/index.md b/content/en/articles/playing-with-colors/index.md index 9a11089..d447790 100644 --- a/content/en/articles/playing-with-colors/index.md +++ b/content/en/articles/playing-with-colors/index.md @@ -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. diff --git a/content/en/articles/sunset-in-siderno/index.md b/content/en/articles/sunset-in-siderno/index.md index daa312f..e59bd47 100644 --- a/content/en/articles/sunset-in-siderno/index.md +++ b/content/en/articles/sunset-in-siderno/index.md @@ -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. diff --git a/themes/danix-xyz-hacker/assets/css/main.min.css b/themes/danix-xyz-hacker/assets/css/main.min.css index fecb6d1..9ce65bf 100644 --- a/themes/danix-xyz-hacker/assets/css/main.min.css +++ b/themes/danix-xyz-hacker/assets/css/main.min.css @@ -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 index 27d6cb2..0000000 --- a/themes/danix-xyz-hacker/layouts/shortcodes/figure.html +++ /dev/null @@ -1,8 +0,0 @@ -{{- $src := .Get "src" -}} -{{- $alt := .Get "alt" -}} -{{- $class := .Get "class" -}} -
- {{- if $src -}}{{ $alt }}{{ end -}} - {{- .Inner -}} - {{- if .Get "caption" -}}
{{ .Get "caption" }}
{{ end -}} -
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 index b9f8098..0000000 --- a/themes/danix-xyz-hacker/layouts/shortcodes/gal-img.html +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ .Get -
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/image.html b/themes/danix-xyz-hacker/layouts/shortcodes/image.html index 0209b7e..84dec3f 100644 --- a/themes/danix-xyz-hacker/layouts/shortcodes/image.html +++ b/themes/danix-xyz-hacker/layouts/shortcodes/image.html @@ -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 -}} -
- {{ $alt }} +{{- if or $src .Inner -}} +
+ {{- if .Inner -}} + {{- .Inner -}} + {{- else -}} + {{- if $link -}}{{- end -}} + {{ $alt }} + {{- if $link -}}{{- end -}} + {{- end -}} {{- if $caption -}} -
- {{ $caption }} -
+
{{ $caption }}
{{- end -}}
{{- 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 index 2393928..0000000 --- a/themes/danix-xyz-hacker/layouts/shortcodes/img.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Get diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/video.html b/themes/danix-xyz-hacker/layouts/shortcodes/video.html index a07500a..1e2645d 100644 --- a/themes/danix-xyz-hacker/layouts/shortcodes/video.html +++ b/themes/danix-xyz-hacker/layouts/shortcodes/video.html @@ -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: - * - * - */}} +{{- $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 }} - - +{{- if $id -}} +
+ +
+{{- else if $src -}} + {{- $ext := $src | path.Ext -}} + {{- $filetype := slicestr $ext 1 -}} + {{- $videoURL := $src -}} + {{- $resource := .Page.Resources.GetMatch $src -}} + {{- if $resource -}}{{- $videoURL = $resource.RelPermalink -}}{{- end -}} + + +{{- 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 index 80cbb93..0000000 --- a/themes/danix-xyz-hacker/layouts/shortcodes/youtube.html +++ /dev/null @@ -1 +0,0 @@ -