Skip to content

Commit

Permalink
Update feature-info.html
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Vishal <[email protected]>
  • Loading branch information
vishalvivekm authored Nov 1, 2024
1 parent 59e5b85 commit d1c3f6c
Showing 1 changed file with 6 additions and 52 deletions.
58 changes: 6 additions & 52 deletions layouts/partials/feature-info.html
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 }}

0 comments on commit d1c3f6c

Please sign in to comment.