generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vivek Vishal <[email protected]>
- Loading branch information
1 parent
59e5b85
commit d1c3f6c
Showing
1 changed file
with
6 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,55 @@ | ||
{{ $currentPage := .Page.Permalink }} | ||
|
||
{{ $features := .Site.Data.features }} | ||
|
||
{{ if not $features }} | ||
|
||
{{ $features = getJSON "features.json" }} | ||
|
||
{{ end }} | ||
|
||
{{ if $features }} | ||
|
||
{{ $groupedFeatures := dict }} | ||
|
||
{{ range $features }} | ||
|
||
{{ $docUrl := .documentation | default "" }} | ||
|
||
{{ $cleanDocUrl := (index (split $docUrl "#") 0) }} | ||
{{ $currentPagePath := path.Clean (urls.Parse $currentPage).Path }} | ||
{{ $cleanDocUrlPath := path.Clean (urls.Parse $cleanDocUrl).Path }} | ||
|
||
{{ if eq $cleanDocUrl $currentPage }} | ||
|
||
{{ if eq $cleanDocUrlPath $currentPagePath }} | ||
{{ $tier := index .entire_row "Subscription Tier" }} | ||
|
||
{{ $feature := index .entire_row "Feature" }} | ||
|
||
{{ $currentFeatures := index $groupedFeatures $tier | default "" }} | ||
|
||
{{ $groupedFeatures = merge $groupedFeatures (dict $tier (printf "%s%s%s" $currentFeatures (cond (eq $currentFeatures | ||
|
||
"") "" ", ") $feature)) }} | ||
{{ $groupedFeatures = merge $groupedFeatures (dict $tier (printf "%s%s%s" $currentFeatures (cond (eq $currentFeatures "") "" ", ") $feature)) }} | ||
|
||
{{ end }} | ||
|
||
{{ end }} | ||
|
||
{{ if ne (len $groupedFeatures) 0 }} | ||
|
||
{{ $maxTier := "" }} | ||
|
||
{{ $maxLength := 0 }} | ||
|
||
{{ range $tier, $features := $groupedFeatures }} | ||
|
||
{{ $length := len (split $features ", ") }} | ||
|
||
{{ if gt $length $maxLength }} | ||
|
||
{{ $maxTier = $tier }} | ||
|
||
{{ $maxLength = $length }} | ||
|
||
{{ end }} | ||
|
||
{{ end }} | ||
|
||
<div class="matterinfo"> | ||
|
||
<h4 class="matterheader">Who can use this feature</h4> | ||
|
||
<div class="plan-support all-plans {{ lower $maxTier }}-plan"> | ||
<img src="/images/subscription.svg" alt="Icon" class="support-icon adaptive-icon" data-modal="false" > | ||
Supported on <a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $maxTier | ||
|
||
}}</span> </a>Plan | ||
|
||
Supported on <a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $maxTier }}</span> </a>Plan | ||
</div> | ||
|
||
{{ if gt (len $groupedFeatures) 1 }} | ||
|
||
<div class="add-ons"> | ||
|
||
<strong>Add-ons:</strong> | ||
|
||
{{ $first := true }} | ||
|
||
{{ range $tier, $features := $groupedFeatures }} | ||
|
||
{{ if ne $tier $maxTier }} | ||
|
||
{{ if not $first }}, {{ end }} | ||
|
||
{{ $first = false }} | ||
|
||
{{ $features }} [<a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $tier | ||
|
||
}}</span></a>] | ||
|
||
{{ $features }} [<a href="https://layer5.io/pricing" class="tier-link" target="_blank"><span class="tier">{{ $tier }}</span></a>] | ||
{{ end }} | ||
|
||
{{ end }} | ||
|
||
</div> | ||
|
||
{{ end }} | ||
|
||
</div> | ||
|
||
{{ end }} | ||
{{ end }} | ||
|