diff --git a/plugins/filters.rb b/plugins/filters.rb
index 9e3324252da..7b08d539df0 100644
--- a/plugins/filters.rb
+++ b/plugins/filters.rb
@@ -70,6 +70,17 @@ module Jekyll
def canonical_url(input)
full_url(input).sub(/index\.\w+$/i, '')
end
+
+ # Sort an array of semvers
+ def semver_sort(input)
+ input.sort_by { |v|
+ val = v['name']
+ if val == "pre 0.7"
+ val = "0.6"
+ end
+ Gem::Version.new(val)
+ }
+ end
end
end
diff --git a/source/components/index.html b/source/components/index.html
index a55d60425b6..e1a0e4ba422 100644
--- a/source/components/index.html
+++ b/source/components/index.html
@@ -26,6 +26,7 @@ regenerate: false
{%- endfor -%}
{%- assign components = site.components | sort: 'title' -%}
+{%- assign components_by_version = site.components | group_by: 'ha_release' | semver_sort | reverse -%}
{%- assign categories = components | map: 'ha_category' | join: ',' | join: ',' | split: ',' | uniq | sort -%}
{%- capture current_version -%}{{ site.current_major_version }}.{{ site.current_minor_version }}{% endcapture -%}
{%- assign added_one_ago_minor_version = site.current_minor_version|minus: 1 -%}
@@ -48,7 +49,11 @@ Support for these components is provided by the Home Assistant community.
Added in {{ current_version }} ({{ current_version_components_count }})
Added in {{ added_one_ago_version }} ({{ one_ago_version_components_count }})
Added in {{ added_two_ago_version }} ({{ two_ago_version_components_count }})
-
+ Added in
{%- for category in categories -%}
{%- assign components_count = components | where: 'ha_category', category | size -%}
{%- if category and category != 'Other' and components_count != 0 -%}