Skip to content

Commit b7fa40c

Browse files
committed
Card: Revert first slash error
1 parent 70e308f commit b7fa40c

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

exampleSite/content/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ description:
77
Documentation for hugo theme
88
{{<card-layout>}}
99
{{<card-section showAsCards="true">}}
10-
{{<card title="Test Product" titleUrl="test-product/" icon="test-tubes" isLanding="true">}}
10+
{{<card title="Test Product" titleUrl="/test-product/" icon="test-tubes" isLanding="true">}}
1111
See explanations and usages of shortcodes
1212
{{</card >}}
13-
{{<card title="NGINX Plus" titleUrl="nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" isLanding="true">}}
13+
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" isLanding="true">}}
1414
See a live example of theme components
1515
{{</card >}}
1616
{{</card-section>}}

exampleSite/content/test-product/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ This is a compilation of all our shortcodes to show how they look, function, res
5454

5555
{{<card-layout >}}
5656
{{<card-section title="NGINX" showAsCards="true" >}}
57-
{{<card title="NGINX Plus" titleUrl="nginx/" brandIcon="NGINX-Plus-product-icon-RGB" >}}
57+
{{<card title="NGINX Plus" titleUrl="/nginx/" brandIcon="NGINX-Plus-product-icon-RGB.svg" >}}
5858
Installing NGINX
5959
{{</card >}}
6060
{{</card-section >}}

layouts/shortcodes/card.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
{{- /* Build the url */ -}}
3636
{{ $url := printf "%s%s" .Page.Permalink $titleUrl }}
3737
{{ if eq (substr $titleUrl 0 1) "/" }}
38-
{{ $suggestedUrlFix := substr $titleUrl 1 }}
39-
{{ errorf "Please do not start the param 'titleUrl' with a forward slash. Got: '%s', use '%s' instead." $titleUrl $suggestedUrlFix }}
38+
{{ $url = printf "%s%s" .Site.BaseURL (substr $titleUrl 1) }}
4039
{{ else if (strings.Contains $titleUrl "https") }}
4140
{{ $url = $titleUrl }}
4241
{{ end }}

0 commit comments

Comments
 (0)