diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-15 15:49:00 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-15 15:49:00 +0200 |
| commit | 0c6fa62f5104b796775a9133fbe684f5eabe08e9 (patch) | |
| tree | 1c7a36c274394603a7fec4c219260211357dccfe | |
| parent | 6196f23e02068294976665701c6677a5de8e716b (diff) | |
| download | danixxyz-0c6fa62f5104b796775a9133fbe684f5eabe08e9.tar.gz danixxyz-0c6fa62f5104b796775a9133fbe684f5eabe08e9.zip | |
feat: add article header and sidebar partials supporting single article template
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/partials/article-header.html | 53 | ||||
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/partials/sidebar.html | 22 |
2 files changed, 75 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/layouts/partials/article-header.html b/themes/danix-xyz-hacker/layouts/partials/article-header.html new file mode 100644 index 0000000..252d87a --- /dev/null +++ b/themes/danix-xyz-hacker/layouts/partials/article-header.html @@ -0,0 +1,53 @@ +{{ $articleType := .Params.type | default "life" }} +{{ $typeConfig := .Site.Params.articleTypes }} +{{ $typeData := index $typeConfig $articleType }} +{{ $isDark := strings.Contains (os.Getenv "THEME") "dark" }} +{{ $color := cond $isDark $typeData.color_dark $typeData.color_light }} + +<div class="mb-8 pb-8 border-b border-border"> + <!-- Type badge --> + {{ if $typeData }} + <span + class="inline-flex items-center px-3 py-1 rounded text-sm font-semibold mb-4 transition-colors" + style="color: {{ $color }}; background-color: {{ $color }}20;" + > + {{ i18n $articleType }} + </span> + {{ end }} + + <!-- Title --> + <h1 class="text-4xl md:text-5xl font-bold text-accent mb-4"> + {{ .Title }} + </h1> + + <!-- Metadata --> + <div class="flex flex-wrap items-center gap-4 text-sm text-text-dim"> + <!-- Publish date --> + {{ if .PublishDate }} + <div class="flex items-center gap-1"> + <i data-feather="calendar" class="w-4 h-4"></i> + <time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}"> + {{ .PublishDate.Format "Jan 2, 2006" }} + </time> + </div> + {{ end }} + + <!-- Update date if different --> + {{ if and .LastMod (ne .LastMod.Format "2006-01-02" .PublishDate.Format "2006-01-02") }} + <div class="flex items-center gap-1"> + <i data-feather="edit-2" class="w-4 h-4"></i> + <time datetime="{{ .LastMod.Format "2006-01-02T15:04:05Z07:00" }}"> + {{ .LastMod.Format "Jan 2, 2006" }} + </time> + </div> + {{ end }} + + <!-- Reading time --> + {{ if .Site.Params.readingTime }} + <div class="flex items-center gap-1"> + <i data-feather="clock" class="w-4 h-4"></i> + <span>{{ .ReadingTime }} {{ i18n "min" }} {{ i18n "readingTime" }}</span> + </div> + {{ end }} + </div> +</div> diff --git a/themes/danix-xyz-hacker/layouts/partials/sidebar.html b/themes/danix-xyz-hacker/layouts/partials/sidebar.html new file mode 100644 index 0000000..f552df9 --- /dev/null +++ b/themes/danix-xyz-hacker/layouts/partials/sidebar.html @@ -0,0 +1,22 @@ +<aside class="order-last md:order-none md:col-span-1"> + <!-- Author info widget (optional - can be expanded) --> + <div class="p-4 border border-border/30 rounded mb-6"> + <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "author" }}</h3> + <p class="text-text-dim text-sm leading-relaxed"> + {{ .Site.Params.author }} + </p> + </div> + + <!-- Related posts widget (optional) --> + {{ if .Site.Params.relatedPosts }} + {{ $related := .GetTerms "tags" }} + {{ if $related }} + <div class="p-4 border border-border/30 rounded"> + <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "relatedPosts" }}</h3> + <div class="space-y-2"> + <!-- Related articles can be implemented here --> + </div> + </div> + {{ end }} + {{ end }} +</aside> |
