Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update logic to display tiers on content pages in local build / preview using make site #409

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading