From f745e9fc0f7ff554bc7d8cb73cad68899dbae773 Mon Sep 17 00:00:00 2001 From: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:30:39 +0530 Subject: [PATCH 1/2] init Signed-off-by: vishalvivekm <110674407+vishalvivekm@users.noreply.github.com> --- layouts/partials/feature-info.html | 51 ++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/layouts/partials/feature-info.html b/layouts/partials/feature-info.html index 09f972fd..0e52831a 100644 --- a/layouts/partials/feature-info.html +++ b/layouts/partials/feature-info.html @@ -1,57 +1,104 @@ {{ $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 }} + {{ $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)) }} + {{ 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 }}
+

Who can use this feature

+
- Icon + + Icon + Supported on {{ $maxTier + }} Plan +
{{ if gt (len $groupedFeatures) 1 }} +
+ Add-ons: + {{ $first := true }} + {{ range $tier, $features := $groupedFeatures }} + {{ if ne $tier $maxTier }} + {{ if not $first }}, {{ end }} + {{ $first = false }} + {{ $features }} [{{ $tier + }}] + {{ end }} + {{ end }} +
+ {{ end }} +
+ {{ end }} -{{ end }} \ No newline at end of file + +{{ end }} + From d1c3f6caf5d7b89aa4792c446a8225d975abb7af Mon Sep 17 00:00:00 2001 From: Vivek Vishal Date: Fri, 1 Nov 2024 20:03:43 +0530 Subject: [PATCH 2/2] Update feature-info.html Signed-off-by: Vivek Vishal --- layouts/partials/feature-info.html | 58 ++++-------------------------- 1 file changed, 6 insertions(+), 52 deletions(-) diff --git a/layouts/partials/feature-info.html b/layouts/partials/feature-info.html index ecb499b9..0d6cb49e 100644 --- a/layouts/partials/feature-info.html +++ b/layouts/partials/feature-info.html @@ -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 }}
-

Who can use this feature

-
Icon - Supported on {{ $maxTier - - }} Plan - + Supported on {{ $maxTier }} Plan
- {{ if gt (len $groupedFeatures) 1 }} -
- Add-ons: - {{ $first := true }} - {{ range $tier, $features := $groupedFeatures }} - {{ if ne $tier $maxTier }} - {{ if not $first }}, {{ end }} - {{ $first = false }} - - {{ $features }} [{{ $tier - - }}] - + {{ $features }} [{{ $tier }}] {{ end }} - {{ end }} -
- {{ end }} -
- {{ end }} {{ end }} -