Skip to content

Commit

Permalink
fix: card links for getting started page
Browse files Browse the repository at this point in the history
  • Loading branch information
imfing committed Aug 26, 2023
1 parent af77173 commit ede8991
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions exampleSite/content/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Voila! You can see your new site at `http://localhost:1313/`.
Explore the following sections to start adding more contents:

{{< cards >}}
{{< card link="organize-files" title="Organize Files" icon="document-duplicate" >}}
{{< card link="configuration" title="Configuration" icon="adjustments" >}}
{{< card link="markdown" title="Markdown" icon="markdown" >}}
{{< card link="../guide/organize-files" title="Organize Files" icon="document-duplicate" >}}
{{< card link="../guide/configuration" title="Configuration" icon="adjustments" >}}
{{< card link="../guide/markdown" title="Markdown" icon="markdown" >}}
{{< /cards >}}
10 changes: 8 additions & 2 deletions layouts/shortcodes/card.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $href := .Get "link" -}}
{{- $link := .Get "link" -}}
{{- $title := .Get "title" -}}
{{- $icon := .Get "icon" -}}
{{- $subtitle := .Get "subtitle" }}
Expand All @@ -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" }}
{{- end -}}

{{- $external := strings.HasPrefix $link "http" -}}

<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 }}"
href="{{ $href }}"
href="{{ $link }}"
{{- if $external -}}
target="_blank"
rel="noreferrer"
{{- end -}}
>
{{- with $image -}}
<img alt="{{ $title }}" loading="lazy" decoding="async" style="color: transparent;" src="{{ $image }}" />
Expand Down

0 comments on commit ede8991

Please sign in to comment.