mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 06:11:27 -04:00
chore: adapt theme to new template system (#696)
* Adapted theme's layout to [Hugo v0.146.0](https://gohugo.io/templates/new-templatesystem-overview/) * Bumped minimal Hugo version to v0.146.0
This commit is contained in:
36
layouts/_shortcodes/hextra/feature-card.html
Normal file
36
layouts/_shortcodes/hextra/feature-card.html
Normal file
@ -0,0 +1,36 @@
|
||||
{{- $title := .Get "title" -}}
|
||||
{{- $subtitle := .Get "subtitle" -}}
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $image := .Get "image" -}}
|
||||
{{- $imageClass := .Get "imageClass" -}}
|
||||
{{- $style := .Get "style" -}}
|
||||
{{- $icon := .Get "icon" -}}
|
||||
{{- $link := .Get "link" -}}
|
||||
|
||||
{{- $external := hasPrefix $link "http" -}}
|
||||
{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}
|
||||
|
||||
{{- if hasPrefix $image "/" -}}
|
||||
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
|
||||
{{- end -}}
|
||||
|
||||
<a
|
||||
{{ with $link }}href="{{ $href }}" {{ with $external }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
class="{{ $class }} hextra-feature-card not-prose hx:block hx:relative hx:overflow-hidden hx:rounded-3xl hx:border hx:border-gray-200 hx:hover:border-gray-300 hx:dark:border-neutral-800 hx:dark:hover:border-neutral-700 hx:before:pointer-events-none hx:before:absolute hx:before:inset-0 hx:before:bg-glass-gradient"
|
||||
>
|
||||
<div class="hx:relative hx:w-full hx:p-6">
|
||||
<h3 class="hx:text-2xl hx:font-medium hx:leading-6 hx:mb-2 hx:flex hx:items-center">
|
||||
{{ with $icon -}}
|
||||
<span class="hx:pr-2">
|
||||
{{- partial "utils/icon.html" (dict "name" . "attributes" "height=1.5rem") -}}
|
||||
</span>
|
||||
{{ end -}}
|
||||
<span>{{ $title }}</span>
|
||||
</h3>
|
||||
<p class="hx:text-gray-500 hx:dark:text-gray-400 hx:text-sm hx:leading-6">{{ $subtitle | markdownify }}</p>
|
||||
</div>
|
||||
{{- with $image -}}
|
||||
<img src="{{ . }}" class="hx:absolute hx:max-w-none {{ $imageClass }}" alt="{{ $title }}" />
|
||||
{{- end -}}
|
||||
</a>
|
12
layouts/_shortcodes/hextra/feature-grid.html
Normal file
12
layouts/_shortcodes/hextra/feature-grid.html
Normal file
@ -0,0 +1,12 @@
|
||||
{{- $cols := .Get "cols" | default 3 -}}
|
||||
{{- $style := .Get "style" | default "" -}}
|
||||
|
||||
{{- $css := printf "--hextra-feature-grid-cols: %v; %s" $cols $style -}}
|
||||
|
||||
|
||||
<div
|
||||
class="hextra-feature-grid hx:grid hx:sm:max-lg:grid-cols-2 hx:max-sm:grid-cols-1 hx:gap-4 hx:w-full not-prose"
|
||||
{{ with $css }}style="{{ . | safeCSS }}"{{ end }}
|
||||
>
|
||||
{{ .Inner }}
|
||||
</div>
|
15
layouts/_shortcodes/hextra/hero-badge.html
Normal file
15
layouts/_shortcodes/hextra/hero-badge.html
Normal file
@ -0,0 +1,15 @@
|
||||
{{- $link := .Get "link" -}}
|
||||
{{- $external := hasPrefix $link "http" -}}
|
||||
{{- $href := cond (hasPrefix $link "/") ($link | relURL) $link -}}
|
||||
{{- $class := .Get "class" }}
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
|
||||
<a
|
||||
{{ if $link }}href="{{ $href }}"{{ end }}
|
||||
class="{{ $class }} not-prose hx:inline-flex hx:items-center hx:rounded-full hx:gap-2 hx:px-3 hx:py-1 hx:text-xs hx:text-gray-600 hx:dark:text-gray-400 hx:bg-gray-100 hx:dark:bg-neutral-800 hx:border-gray-200 hx:dark:border-neutral-800 hx:border hx:hover:border-gray-400 hx:dark:hover:text-gray-50 hx:dark:hover:border-gray-600 hx:transition-all hx:ease-in hx:duration-200"
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
{{ if $external }}target="_blank" rel="noreferrer"{{ end -}}
|
||||
>
|
||||
{{ .Inner | markdownify }}
|
||||
</a>
|
15
layouts/_shortcodes/hextra/hero-button.html
Normal file
15
layouts/_shortcodes/hextra/hero-button.html
Normal file
@ -0,0 +1,15 @@
|
||||
{{- $link := .Get "link" -}}
|
||||
{{- $text := .Get "text" -}}
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
{{- $external := hasPrefix $link "http" -}}
|
||||
{{- $href := cond (hasPrefix $link "/") ($link | relURL) $link -}}
|
||||
|
||||
<a
|
||||
href="{{ $href }}"
|
||||
class="not-prose hx:font-medium hx:cursor-pointer hx:px-6 hx:py-3 hx:rounded-full hx:text-center hx:text-white hx:inline-block hx:bg-primary-600 hx:hover:bg-primary-700 hx:focus:outline-hidden hx:focus:ring-4 hx:focus:ring-primary-300 hx:dark:bg-primary-600 hx:dark:hover:bg-primary-700 hx:dark:focus:ring-primary-800 hx:transition-all hx:ease-in hx:duration-200"
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
{{ if $external }}target="_blank" rel="noreferrer"{{ end -}}
|
||||
>
|
||||
{{- $text -}}
|
||||
</a>
|
38
layouts/_shortcodes/hextra/hero-container.html
Normal file
38
layouts/_shortcodes/hextra/hero-container.html
Normal file
@ -0,0 +1,38 @@
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $cols := .Get "cols" | default 2 -}}
|
||||
{{- $image := .Get "image" -}}
|
||||
{{- $imageCard := .Get "imageCard" | default false -}}
|
||||
{{- $imageClass := .Get "imageClass" -}}
|
||||
{{- $imageLink := .Get "imageLink" -}}
|
||||
{{- $imageLinkExternal := hasPrefix $imageLink "http" -}}
|
||||
{{- $imageStyle := .Get "imageStyle" -}}
|
||||
{{- $imageTitle := .Get "imageTitle" -}}
|
||||
{{- $imageWidth := .Get "imageWidth" | default 350 -}}
|
||||
{{- $imageHeight := .Get "imageHeight" | default 350 -}}
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
{{- $css := printf "--hextra-feature-grid-cols: %v; %s" $cols $style -}}
|
||||
{{- $href := cond (hasPrefix $imageLink "/") ($imageLink | relURL) $imageLink -}}
|
||||
{{- if hasPrefix $image "/" -}}
|
||||
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
|
||||
{{- end -}}
|
||||
|
||||
<div
|
||||
class="{{ $class }} hextra-feature-grid hx:grid hx:sm:max-lg:grid-cols-2 hx:max-sm:grid-cols-1 hx:gap-4 hx:w-full not-prose"
|
||||
{{ with $css }}style="{{ . | safeCSS }}"{{ end }}
|
||||
>
|
||||
<div class="hx:w-full">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
{{- with $image }}
|
||||
<div class="hx:mx-auto">
|
||||
<a
|
||||
{{ with $imageLink }}href="{{ $href }}" {{ with $imageLinkExternal }} target="_blank" rel="noreferrer"{{ end }}{{ end }}
|
||||
{{ with $imageStyle }}style="{{ . | safeCSS }}"{{ end }}
|
||||
class="{{ $imageClass }} {{ if $imageCard }}hextra-feature-card not-prose hx:block hx:relative hx:p-6 hx:overflow-hidden hx:rounded-3xl hx:border hx:border-gray-200 hx:hover:border-gray-300 hx:dark:border-neutral-800 hx:dark:hover:border-neutral-700 hx:before:pointer-events-none hx:before:absolute hx:before:inset-0 hx:before:bg-glass-gradient{{ end }}"
|
||||
>
|
||||
<img src="{{ $image }}" width="{{ $imageWidth }}" height="{{ $imageHeight }}" {{ with $imageTitle }}alt="{{ $imageTitle }}"{{ end }}/>
|
||||
</a>
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
9
layouts/_shortcodes/hextra/hero-headline.html
Normal file
9
layouts/_shortcodes/hextra/hero-headline.html
Normal file
@ -0,0 +1,9 @@
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
|
||||
<h1
|
||||
class="not-prose hx:text-4xl hx:font-bold hx:leading-none hx:tracking-tighter hx:md:text-5xl hx:py-2 hx:bg-clip-text hx:text-transparent hx:bg-gradient-to-r hx:from-gray-900 hx:to-gray-600 hx:dark:from-gray-100 hx:dark:to-gray-400"
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
>
|
||||
{{ .Inner | markdownify }}
|
||||
</h1>
|
10
layouts/_shortcodes/hextra/hero-section.html
Normal file
10
layouts/_shortcodes/hextra/hero-section.html
Normal file
@ -0,0 +1,10 @@
|
||||
{{- $style := .Get "style" -}}
|
||||
{{- $heading := int (strings.TrimPrefix "h" (.Get "heading" | default "h2")) -}}
|
||||
{{- $size := cond (ge $heading 4) "xl" (cond (eq $heading 3) "2xl" "4xl") -}}
|
||||
|
||||
<h{{ $heading }}
|
||||
class="not-prose hx:text-{{ $size }} hx:font-bold hx:leading-none hx:tracking-tighter hx:md:text-3xl hx:py-2 hx:bg-clip-text hx:text-transparent hx:bg-gradient-to-r hx:from-gray-900 hx:to-gray-600 hx:dark:from-gray-100 hx:dark:to-gray-400"
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
>
|
||||
{{ .Inner | markdownify }}
|
||||
</h{{ $heading }}>
|
9
layouts/_shortcodes/hextra/hero-subtitle.html
Normal file
9
layouts/_shortcodes/hextra/hero-subtitle.html
Normal file
@ -0,0 +1,9 @@
|
||||
{{- $style := .Get "style" -}}
|
||||
|
||||
|
||||
<p
|
||||
class="not-prose hx:text-xl hx:text-gray-600 hx:dark:text-gray-400 hx:sm:text-xl"
|
||||
{{ with $style }}style="{{ . | safeCSS }}"{{ end }}
|
||||
>
|
||||
{{ .Inner | markdownify }}
|
||||
</p>
|
Reference in New Issue
Block a user