fix: card links for getting started page

This commit is contained in:
Xin 2023-08-26 15:01:06 +01:00
parent af77173a35
commit ede8991728
2 changed files with 11 additions and 5 deletions

View File

@ -66,7 +66,7 @@ Voila! You can see your new site at `http://localhost:1313/`.
Explore the following sections to start adding more contents: Explore the following sections to start adding more contents:
{{< cards >}} {{< cards >}}
{{< card link="organize-files" title="Organize Files" icon="document-duplicate" >}} {{< card link="../guide/organize-files" title="Organize Files" icon="document-duplicate" >}}
{{< card link="configuration" title="Configuration" icon="adjustments" >}} {{< card link="../guide/configuration" title="Configuration" icon="adjustments" >}}
{{< card link="markdown" title="Markdown" icon="markdown" >}} {{< card link="../guide/markdown" title="Markdown" icon="markdown" >}}
{{< /cards >}} {{< /cards >}}

View File

@ -1,4 +1,4 @@
{{- $href := .Get "link" -}} {{- $link := .Get "link" -}}
{{- $title := .Get "title" -}} {{- $title := .Get "title" -}}
{{- $icon := .Get "icon" -}} {{- $icon := .Get "icon" -}}
{{- $subtitle := .Get "subtitle" }} {{- $subtitle := .Get "subtitle" }}
@ -10,9 +10,15 @@
{{ $linkClass = "hover:border-gray-300 bg-gray-100 shadow dark:border-neutral-700 dark:bg-neutral-800 dark:text-gray-50 hover:shadow-lg dark:hover:border-neutral-500 dark:hover:bg-neutral-700" }} {{ $linkClass = "hover:border-gray-300 bg-gray-100 shadow dark:border-neutral-700 dark:bg-neutral-800 dark:text-gray-50 hover:shadow-lg dark:hover:border-neutral-500 dark:hover:bg-neutral-700" }}
{{- end -}} {{- end -}}
{{- $external := strings.HasPrefix $link "http" -}}
<a <a
class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}" class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}"
href="{{ $href }}" href="{{ $link }}"
{{- if $external -}}
target="_blank"
rel="noreferrer"
{{- end -}}
> >
{{- with $image -}} {{- with $image -}}
<img alt="{{ $title }}" loading="lazy" decoding="async" style="color: transparent;" src="{{ $image }}" /> <img alt="{{ $title }}" loading="lazy" decoding="async" style="color: transparent;" src="{{ $image }}" />