From ede89917285d19ab2dc80b31dbe71bfcb260eb0e Mon Sep 17 00:00:00 2001 From: Xin Date: Sat, 26 Aug 2023 15:01:06 +0100 Subject: [PATCH] fix: card links for getting started page --- exampleSite/content/docs/getting-started.md | 6 +++--- layouts/shortcodes/card.html | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/exampleSite/content/docs/getting-started.md b/exampleSite/content/docs/getting-started.md index 8e349e6..eb89abf 100644 --- a/exampleSite/content/docs/getting-started.md +++ b/exampleSite/content/docs/getting-started.md @@ -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 >}} diff --git a/layouts/shortcodes/card.html b/layouts/shortcodes/card.html index 79e8449..3d9af16 100644 --- a/layouts/shortcodes/card.html +++ b/layouts/shortcodes/card.html @@ -1,4 +1,4 @@ -{{- $href := .Get "link" -}} +{{- $link := .Get "link" -}} {{- $title := .Get "title" -}} {{- $icon := .Get "icon" -}} {{- $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" }} {{- end -}} +{{- $external := strings.HasPrefix $link "http" -}} + {{- with $image -}} {{ $title }}