Skip to content

Commit 4651971

Browse files
author
Vivek Vishal
authored
Merge pull request #409 from vishalvivekm/logic
chore: update logic to display tiers on content pages in local build / preview using make site
2 parents 58de102 + d1c3f6c commit 4651971

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

layouts/partials/feature-info.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{{ $currentPage := .Page.Permalink }}
22
{{ $features := .Site.Data.features }}
3-
43
{{ if not $features }}
54
{{ $features = getJSON "features.json" }}
65
{{ end }}
7-
86
{{ if $features }}
97
{{ $groupedFeatures := dict }}
108
{{ range $features }}
119
{{ $docUrl := .documentation | default "" }}
1210
{{ $cleanDocUrl := (index (split $docUrl "#") 0) }}
13-
{{ if eq $cleanDocUrl $currentPage }}
11+
{{ $currentPagePath := path.Clean (urls.Parse $currentPage).Path }}
12+
{{ $cleanDocUrlPath := path.Clean (urls.Parse $cleanDocUrl).Path }}
13+
14+
{{ if eq $cleanDocUrlPath $currentPagePath }}
1415
{{ $tier := index .entire_row "Subscription Tier" }}
1516
{{ $feature := index .entire_row "Feature" }}
1617
{{ $currentFeatures := index $groupedFeatures $tier | default "" }}
17-
{{ $groupedFeatures = merge $groupedFeatures (dict $tier (printf "%s%s%s" $currentFeatures (cond (eq $currentFeatures
18-
"") "" ", ") $feature)) }}
18+
{{ $groupedFeatures = merge $groupedFeatures (dict $tier (printf "%s%s%s" $currentFeatures (cond (eq $currentFeatures "") "" ", ") $feature)) }}
19+
1920
{{ end }}
2021
{{ end }}
2122

@@ -34,10 +35,8 @@
3435
<h4 class="matterheader">Who can use this feature</h4>
3536
<div class="plan-support all-plans {{ lower $maxTier }}-plan">
3637
<img src="/images/subscription.svg" alt="Icon" class="support-icon adaptive-icon" data-modal="false" >
37-
Supported on <a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $maxTier
38-
}}</span> </a>Plan
38+
Supported on <a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $maxTier }}</span> </a>Plan
3939
</div>
40-
4140
{{ if gt (len $groupedFeatures) 1 }}
4241
<div class="add-ons">
4342
<strong>Add-ons:</strong>
@@ -46,8 +45,7 @@ <h4 class="matterheader">Who can use this feature</h4>
4645
{{ if ne $tier $maxTier }}
4746
{{ if not $first }}, {{ end }}
4847
{{ $first = false }}
49-
{{ $features }} [<a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $tier
50-
}}</span></a>]
48+
{{ $features }} [<a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $tier }}</span></a>]
5149
{{ end }}
5250
{{ end }}
5351
</div>

0 commit comments

Comments
 (0)