]> danix's work - danix.xyz-2.git/commitdiff
feat: add social-share partial with 9 targets and two layout modes
authorDanilo M. <redacted>
Fri, 17 Apr 2026 14:36:22 +0000 (16:36 +0200)
committerDanilo M. <redacted>
Fri, 17 Apr 2026 14:36:22 +0000 (16:36 +0200)
.claude/settings.local.json
TODO.md
themes/danix-xyz-hacker/assets/css/main.min.css
themes/danix-xyz-hacker/layouts/partials/social-share.html [new file with mode: 0644]

index b96ee8de8a015446fff38f03827823439a206640..ab7c2d927cda1fda1bcbba7fc6ba32e819c9b17b 100644 (file)
@@ -16,7 +16,8 @@
       "Bash(hugo server *)",
       "Bash(hugo config *)",
       "Bash(hugo --debug)",
-      "Bash(hugo)"
+      "Bash(hugo)",
+      "Bash(hugo -D)"
     ]
   }
 }
diff --git a/TODO.md b/TODO.md
index 12cab199a5259d3b8b06e13c14070e9a796b0e3c..ddf6a908107c4144469a5646dfbdc67a26846979 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,7 +1,9 @@
 # danix.xyz Week 6+ TODO List
 
-- [ ] Related Articles widget in sidebar.
+- [✅] Related Articles widget in sidebar.
+- [⌛] social sharing sidebar widget
 - [ ] Footer redesign (3-column, social badges, fortune cookie, tech badges, etc.)
+- [ ] shortcodes cleanup (remove duplicates)
 - [ ] Search functionality
 - [ ] Open Graph meta tags for social sharing
 - [ ] Sitemap & robots.txt optimization
index e92eb90343de6bde47e70dfa5261bbe531993479..aaf57fdda12e2cdc0d6bd954599283a795b97ac2 100644 (file)
@@ -1689,10 +1689,18 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   margin-bottom: 2rem;
 }
 
+.ml-1 {
+  margin-left: 0.25rem;
+}
+
 .ml-2 {
   margin-left: 0.5rem;
 }
 
+.mt-0\.5 {
+  margin-top: 0.125rem;
+}
+
 .mt-1 {
   margin-top: 0.25rem;
 }
@@ -1725,6 +1733,13 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   margin-top: 2rem;
 }
 
+.line-clamp-1 {
+  overflow: hidden;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 1;
+}
+
 .line-clamp-3 {
   overflow: hidden;
   display: -webkit-box;
@@ -1964,6 +1979,12 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   overflow-y: auto;
 }
 
+.truncate {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
 .rounded {
   border-radius: 0.25rem;
 }
@@ -2001,6 +2022,10 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   border-left-width: 1px;
 }
 
+.border-l-2 {
+  border-left-width: 2px;
+}
+
 .border-l-4 {
   border-left-width: 4px;
 }
@@ -2117,6 +2142,10 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   padding-bottom: 2rem;
 }
 
+.pl-3 {
+  padding-left: 0.75rem;
+}
+
 .pl-6 {
   padding-left: 1.5rem;
 }
@@ -2218,6 +2247,10 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg {
   line-height: 1.625;
 }
 
+.leading-snug {
+  line-height: 1.375;
+}
+
 .text-accent {
   color: var(--accent);
 }
diff --git a/themes/danix-xyz-hacker/layouts/partials/social-share.html b/themes/danix-xyz-hacker/layouts/partials/social-share.html
new file mode 100644 (file)
index 0000000..6934f4e
--- /dev/null
@@ -0,0 +1,123 @@
+{{ $page := .page }}
+{{ $mode := .mode | default "sidebar" }}
+{{ $url := $page.Permalink | urlquery }}
+{{ $title := $page.Title | urlquery }}
+
+{{ $gridClass := "grid-cols-2 gap-2" }}
+{{ if eq $mode "inline" }}
+  {{ $gridClass = "grid-cols-5 gap-3 justify-items-center" }}
+{{ end }}
+
+<div class="p-4 border border-border/30 rounded mb-6">
+  <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "share" }}</h3>
+  <nav aria-label="{{ i18n "share" }}">
+    <div class="grid {{ $gridClass }}">
+
+      <!-- Copy link -->
+      <div x-data="{ copied: false }">
+        <button
+          @click="navigator.clipboard.writeText('{{ $page.Permalink }}').then(() => { copied = true; setTimeout(() => copied = false, 2000) })"
+          :aria-label="copied ? '{{ i18n "linkCopied" }}' : '{{ i18n "copyLink" }}'"
+          class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+        >
+          <i x-show="!copied" data-feather="copy" class="w-5 h-5" aria-hidden="true"></i>
+          <i x-show="copied" data-feather="check" class="w-5 h-5 text-accent2" aria-hidden="true"></i>
+        </button>
+      </div>
+
+      <!-- Email -->
+      <a
+        href="mailto:?subject={{ $title }}&body={{ $title }}%0A%0A{{ $page.Permalink | urlquery }}"
+        aria-label="{{ i18n "shareViaEmail" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <i data-feather="mail" class="w-5 h-5" aria-hidden="true"></i>
+      </a>
+
+      <!-- Facebook -->
+      <a
+        href="https://www.facebook.com/sharer/sharer.php?u={{ $url }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "facebook" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
+          <path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"/>
+        </svg>
+      </a>
+
+      <!-- Twitter / X -->
+      <a
+        href="https://twitter.com/intent/tweet?url={{ $url }}&text={{ $title }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "twitter" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>
+        </svg>
+      </a>
+
+      <!-- Reddit -->
+      <a
+        href="https://www.reddit.com/submit?url={{ $url }}&title={{ $title }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "reddit" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M12 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0zm5.01 4.744c.688 0 1.25.561 1.25 1.249a1.25 1.25 0 0 1-2.498.056l-2.597-.547-.8 3.747c1.824.07 3.48.632 4.674 1.488.308-.309.73-.491 1.207-.491.968 0 1.754.786 1.754 1.754 0 .716-.435 1.333-1.01 1.614a3.111 3.111 0 0 1 .042.52c0 2.694-3.13 4.87-7.004 4.87-3.874 0-7.004-2.176-7.004-4.87 0-.183.015-.366.043-.534A1.748 1.748 0 0 1 4.028 12c0-.968.786-1.754 1.754-1.754.463 0 .898.196 1.207.49 1.207-.883 2.878-1.43 4.744-1.487l.885-4.182a.342.342 0 0 1 .14-.197.35.35 0 0 1 .238-.042l2.906.617a1.214 1.214 0 0 1 1.108-.701zM9.25 12C8.561 12 8 12.562 8 13.25c0 .687.561 1.248 1.25 1.248.687 0 1.248-.561 1.248-1.249 0-.688-.561-1.249-1.249-1.249zm5.5 0c-.687 0-1.248.561-1.248 1.25 0 .687.561 1.248 1.249 1.248.688 0 1.249-.561 1.249-1.249 0-.687-.562-1.249-1.25-1.249zm-5.466 3.99a.327.327 0 0 0-.231.094.33.33 0 0 0 0 .463c.842.842 2.484.913 2.961.913.477 0 2.105-.056 2.961-.913a.361.361 0 0 0 .029-.463.33.33 0 0 0-.464 0c-.547.533-1.684.73-2.512.73-.828 0-1.979-.196-2.512-.73a.326.326 0 0 0-.232-.095z"/>
+        </svg>
+      </a>
+
+      <!-- Pinterest -->
+      <a
+        href="https://pinterest.com/pin/create/button/?url={{ $url }}&description={{ $title }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "pinterest" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M12 0C5.373 0 0 5.373 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.782c0-1.668.967-2.914 2.171-2.914 1.023 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.133 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.138.893 2.738a.36.36 0 0 1 .083.345l-.333 1.36c-.053.22-.174.267-.402.161-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.359-.632-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146C9.57 23.812 10.763 24 12 24c6.627 0 12-5.373 12-12S18.627 0 12 0z"/>
+        </svg>
+      </a>
+
+      <!-- WhatsApp -->
+      <a
+        href="https://api.whatsapp.com/send?text={{ $title }}%20{{ $page.Permalink | urlquery }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "whatsapp" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413z"/>
+        </svg>
+      </a>
+
+      <!-- Telegram -->
+      <a
+        href="https://t.me/share/url?url={{ $url }}&text={{ $title }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "telegram" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/>
+        </svg>
+      </a>
+
+      <!-- Signal -->
+      <a
+        href="https://signal.me/#p/{{ $page.Permalink | urlquery }}"
+        target="_blank" rel="noopener noreferrer"
+        aria-label="{{ i18n "signal" }}"
+        class="btn-icon hover:text-accent hover:bg-surface transition-colors focus-visible:ring-2 focus-visible:ring-accent"
+      >
+        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" stroke="none" aria-hidden="true" focusable="false">
+          <path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm.157 5.32a6.68 6.68 0 0 1 6.143 4.032l.734-.267.55 1.513-.717.261a6.71 6.71 0 0 1 .133 1.327 6.68 6.68 0 0 1-.176 1.51l.69.252-.55 1.513-.707-.258A6.68 6.68 0 0 1 12 18.68a6.68 6.68 0 0 1-6.294-4.455l-.66.24-.55-1.513.677-.247A6.71 6.71 0 0 1 5 12.187a6.71 6.71 0 0 1 .16-1.438l-.698-.254.55-1.513.725.264A6.68 6.68 0 0 1 12.157 5.32zM12 7.2a4.8 4.8 0 1 0 0 9.6A4.8 4.8 0 0 0 12 7.2z"/>
+        </svg>
+      </a>
+
+    </div>
+  </nav>
+</div>