Skip to content

Commit

Permalink
Merge pull request #409 from vishalvivekm/logic
Browse files Browse the repository at this point in the history
chore: update logic to display tiers on content pages in local build / preview using make site
  • Loading branch information
vishalvivekm authored Nov 1, 2024
2 parents 58de102 + d1c3f6c commit 4651971
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions layouts/partials/feature-info.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{{ $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) }}
{{ if eq $cleanDocUrl $currentPage }}
{{ $currentPagePath := path.Clean (urls.Parse $currentPage).Path }}
{{ $cleanDocUrlPath := path.Clean (urls.Parse $cleanDocUrl).Path }}

{{ 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 }}

Expand All @@ -34,10 +35,8 @@
<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>
Expand All @@ -46,8 +45,7 @@ <h4 class="matterheader">Who can use this feature</h4>
{{ 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>
Expand Down

0 comments on commit 4651971

Please sign in to comment.