]> danix's work - danix2-hugo-theme.git/commitdiff
feat: import all remaining shortcodes from previous theme
authorDanilo M. <redacted>
Sun, 5 Apr 2026 07:42:46 +0000 (09:42 +0200)
committerDanilo M. <redacted>
Sun, 5 Apr 2026 07:42:46 +0000 (09:42 +0200)
Added 11 additional shortcodes with complete documentation:

Text formatting:
- strike: strikethrough text
- em: highlighted/marked text
- dropcap: paragraph with decorative drop cap

Container wrappers:
- div / div-close: semantic div containers with classes

Gallery:
- gallery: gallery container
- gal-img: gallery images (400px WebP thumbnail with link)

Utility:
- svg: inline SVG icons from assets/SVGs/
- actions: button-style action links
- search: search form with results display
- contact: comprehensive contact form

All shortcodes now fully documented in CONTENT_GUIDE with usage examples and parameters.

Co-Authored-By: Claude Haiku 4.5 <redacted>
12 files changed:
CONTENT_GUIDE.md
layouts/shortcodes/actions.html [new file with mode: 0644]
layouts/shortcodes/contact.html [new file with mode: 0644]
layouts/shortcodes/div-close.html [new file with mode: 0644]
layouts/shortcodes/div.html [new file with mode: 0644]
layouts/shortcodes/dropcap.html [new file with mode: 0644]
layouts/shortcodes/em.html [new file with mode: 0644]
layouts/shortcodes/gal-img.html [new file with mode: 0644]
layouts/shortcodes/gallery.html [new file with mode: 0644]
layouts/shortcodes/search.html [new file with mode: 0644]
layouts/shortcodes/strike.html [new file with mode: 0644]
layouts/shortcodes/svg.html [new file with mode: 0644]

index b0711666a12f5411fa92f94e99ca857adf6bc5cb..3f163406f438eef83b538445b375da5a525df458 100644 (file)
@@ -663,6 +663,157 @@ Styled video with custom class:
 
 ---
 
+### Text Formatting Shortcodes
+
+#### Strike Shortcode
+
+Creates strikethrough text.
+
+**Usage:**
+```hugo
+{{< strike >}}This text is crossed out{{< /strike >}}
+```
+
+#### Highlight (em) Shortcode
+
+Creates highlighted/marked text (yellow background).
+
+**Usage:**
+```hugo
+{{< em >}}This text is highlighted{{< /em >}}
+```
+
+#### Dropcap Shortcode
+
+Creates a paragraph with a decorative drop cap (large first letter).
+
+**Usage:**
+```hugo
+{{< dropcap >}}
+Once upon a time, there was a beautiful story that began with this first letter...
+{{< /dropcap >}}
+```
+
+**Parameters:**
+- `class` (optional) — CSS class for styling
+
+---
+
+### Container Shortcodes
+
+#### Div Shortcode
+
+Opens a `<div>` wrapper with optional CSS class. Pair with `div-close` shortcode.
+
+**Usage:**
+```hugo
+{{< div class="container featured" >}}
+Content inside the div
+{{< div-close >}}
+```
+
+**Parameters:**
+- `class` — CSS class(es) for the div element
+
+#### Div-Close Shortcode
+
+Closes a div opened with the `div` shortcode.
+
+---
+
+### Gallery Shortcodes
+
+#### Gallery Shortcode
+
+Creates a gallery container for displaying multiple images.
+
+**Usage:**
+```hugo
+{{< gallery >}}
+{{< gal-img src="photo1.jpg" alt="Photo 1" >}}
+{{< gal-img src="photo2.jpg" alt="Photo 2" >}}
+{{< /gallery >}}
+```
+
+#### Gallery Image (gal-img) Shortcode
+
+Embeds an image in a gallery. Must be used inside a `gallery` shortcode.
+
+**Usage:**
+```hugo
+{{< gal-img src="image.jpg" alt="Image description" >}}
+```
+
+**Parameters:**
+- `src` (required) — Path to image file
+- `alt` (required) — Alt text for accessibility
+
+---
+
+### Utility Shortcodes
+
+#### SVG Shortcode
+
+Embeds inline SVG icons from your `assets/SVGs/` folder.
+
+**Usage:**
+```hugo
+{{< svg name="icon-name" class="optional-class" >}}
+```
+
+**Parameters:**
+- `name` (required) — Name of SVG file (without .svg extension). File must be in `assets/SVGs/` folder.
+- `class` (optional) — CSS class for styling the icon
+
+**Example:**
+```hugo
+{{< svg name="github" class="social-icon" >}}
+```
+
+#### Actions Shortcode
+
+Creates a button-style action link (useful for CTAs).
+
+**Usage:**
+```hugo
+{{< actions url="https://example.com" desc="Click Me" outclass="optional-wrapper-class" inclass="optional-button-class" >}}
+```
+
+**Parameters:**
+- `url` (required) — Link URL
+- `desc` (required) — Button text
+- `outclass` (optional) — CSS class for the `<ul>` wrapper
+- `inclass` (optional) — CSS class for the `<a>` button element
+
+**Example:**
+```hugo
+{{< actions url="https://github.com/danix2" desc="Visit my GitHub" outclass="centered" inclass="primary" >}}
+```
+
+#### Search Shortcode
+
+Embeds a search form with results display. Requires JavaScript integration.
+
+**Usage:**
+```hugo
+{{< search >}}
+```
+
+**Note:** This shortcode requires corresponding JavaScript and i18n (internationalization) configuration to function properly.
+
+#### Contact Shortcode
+
+Embeds a comprehensive contact form with fields for name, email, subject, and message.
+
+**Usage:**
+```hugo
+{{< contact >}}
+```
+
+**Note:** The form POSTs to `/php/contact.php` by default. You can update the form action in the shortcode if using a different backend endpoint.
+
+---
+
 ## Troubleshooting
 
 ### Article doesn't appear on site
diff --git a/layouts/shortcodes/actions.html b/layouts/shortcodes/actions.html
new file mode 100644 (file)
index 0000000..296a211
--- /dev/null
@@ -0,0 +1,7 @@
+{{ $link := .Get "url" }}
+{{ $desc := .Get "desc" }}
+{{ $outclass := .Get "outclass" }}
+{{ $inclass := .Get "inclass" }}
+<ul class="actions{{ with $outclass }} {{ . }}{{ end }}">
+       <li><a href="{{ $link }}" class="button{{ with $inclass }} {{ . }}{{ end }}">{{ $desc }}</a></li>
+</ul>
diff --git a/layouts/shortcodes/contact.html b/layouts/shortcodes/contact.html
new file mode 100644 (file)
index 0000000..06be1f5
--- /dev/null
@@ -0,0 +1,49 @@
+{{- $sig := resources.Get "/uploads/2018/05/new-signature.png" -}}
+<section id="contact">
+  <div class="inner">
+    <section>
+
+      <p class="error message js-hidden">Javascript is required for this form to work</p>
+      <p class="contact-submitted status message hidden">Your message has been sent correctly. I'll get back at you as soon as possible</p>
+      <p class="contact-error error message hidden">There's been a problem with your message, I'll dispatch the wizard to investigate the issue.</p>
+
+      <form class="contact-form hidden" data-protect="/php/contact.php" action="#" method="post" accept-charset="UTF-8">
+        <div class="fields">
+          <div class="field half">
+            <label for="edit-name">Name:</label>
+            <input type="text" id="edit-name" name="name" placeholder="Insert your name" required autofocus>
+          </div>
+          <div class="field half">
+            <label for="edit-mail">Email:</label>
+            <input type="email" id="edit-mail" name="email" placeholder="your email address" required>
+          </div>
+          <div class="field">
+            <label for="edit-subject">What are we talking about?</label>
+            <input type="text" id="edit-subject" name="subject" placeholder="add a subject" required>
+          </div>
+          <div class="field">
+            <label for="edit-message">Tell me everything :)</label>
+            <textarea id="edit-message" name="message" rows="5" placeholder="Insert your message here" required></textarea>
+          </div>
+        </div>
+        <input type="text" id="edit-url" class="hidden" name="url" placeholder="your website">
+        <ul class="actions">
+          <li><input type="submit" name="submit" class="form-submit primary" disabled value="Send Message" /></li>
+          <li><input type="reset" name="reset" class="form-reset" disabled value="clear" /></li>
+        </ul>
+
+      </form>
+    </section>
+
+    <section class="split">
+      <section>
+        <div class="contact-method">
+          <span class="icon solid alt fa-envelope"></span>
+          <h3>Reach out to me</h3>
+          <p>I'm here to help, if you need to talk to me feel free to reach out and tell me whatever you need help with, I'll be happy to find some time to discuss the matter with you!</p>
+          <img class="signature image right" src="{{ $sig.RelPermalink }}" alt="signed by danix">
+        </div>
+      </section>
+    </section>
+  </div>
+</section>
diff --git a/layouts/shortcodes/div-close.html b/layouts/shortcodes/div-close.html
new file mode 100644 (file)
index 0000000..ea7e47c
--- /dev/null
@@ -0,0 +1,2 @@
+</div>
+
diff --git a/layouts/shortcodes/div.html b/layouts/shortcodes/div.html
new file mode 100644 (file)
index 0000000..0c0b755
--- /dev/null
@@ -0,0 +1,4 @@
+{{ if .Get "class" }}
+<div class="{{ with .Get "class" }}{{ . }}{{ end }}">
+{{ end }}
+
diff --git a/layouts/shortcodes/dropcap.html b/layouts/shortcodes/dropcap.html
new file mode 100644 (file)
index 0000000..80cbefe
--- /dev/null
@@ -0,0 +1,14 @@
+{{/*
+       * The dropcap shortcode:
+       *
+       * Usage:
+       *
+       * {{< dropcap class="some class" >}}
+       * your paragraph that will have a drop cap here
+       * {{< /dropcap >}}
+       *
+       */}}
+
+<p class="has-dropcap {{ with .Get "class"}}{{.}}{{ end }}">
+       {{ .InnerDeindent }}
+</p>
diff --git a/layouts/shortcodes/em.html b/layouts/shortcodes/em.html
new file mode 100644 (file)
index 0000000..11f399a
--- /dev/null
@@ -0,0 +1 @@
+<mark>{{ .Inner | markdownify }}</mark>
diff --git a/layouts/shortcodes/gal-img.html b/layouts/shortcodes/gal-img.html
new file mode 100644 (file)
index 0000000..0693319
--- /dev/null
@@ -0,0 +1,7 @@
+{{- $src := .Get "src" -}}
+{{- $source := resources.Get $src -}}
+{{- $alt := .Get "alt" -}}
+{{- $icon := $source.Resize "400x webp" -}}
+<a class="gallery-item" href="{{ $source.RelPermalink }}" target="_blank">
+    <img src="{{ $icon.RelPermalink }}" alt="{{ $alt }}">
+</a>
diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html
new file mode 100644 (file)
index 0000000..8a30fc5
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="gallery">
+    <div class="gallery-inner">
+        {{ .Inner }}
+    </div>
+</div>
diff --git a/layouts/shortcodes/search.html b/layouts/shortcodes/search.html
new file mode 100644 (file)
index 0000000..784c598
--- /dev/null
@@ -0,0 +1,22 @@
+<p class="error message js-hidden">{{ i18n "js_required" }}</p>
+<p class="search-loading status message hidden">{{ i18n "search_loading" }}</p>
+
+<div class="search-input hidden">
+  <form id="search-form" class="search-form" action="#" method="post" accept-charset="UTF-8" role="search">
+    <label for="query" class="visually-hidden">{{ i18n "search_title" }}</label>
+    <input type="search" id="query" name="query" class="search-text" placeholder="{{ i18n "search_placeholder" }}" maxlength="128">
+    <button type="submit" name="submit" class="form-submit" >{{ i18n "search_title" }}</button>
+  </form>
+</div>
+
+<div class="search-results"></div>
+
+<template>
+  <article class="search-result list-view">
+    <header>
+      <h2 class="title title-submitted"><a href="#">Title here</a></h2>
+      <div class="submitted"><time class="created-date">Date here</time></div>
+    </header>
+    <div class="content">Summary here</div>
+  </article>
+</template>
diff --git a/layouts/shortcodes/strike.html b/layouts/shortcodes/strike.html
new file mode 100644 (file)
index 0000000..415036a
--- /dev/null
@@ -0,0 +1 @@
+<strike>{{ .Inner | markdownify }}</strike>
diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html
new file mode 100644 (file)
index 0000000..d042bb0
--- /dev/null
@@ -0,0 +1,5 @@
+<span class="inline-svg{{ with .Get "class" }} {{ . }}{{ end }}">
+{{- $fname := print "SVGs/" ( .Get "name" ) ".svg" -}}
+{{ $icon := resources.Get $fname }}
+{{ $icon.Content | safeHTML }}
+</span>