diff --git a/build/_includes/icons/brand.html b/build/_includes/icons/brand.html
index 84a70de99..dac56a6bd 100644
--- a/build/_includes/icons/brand.html
+++ b/build/_includes/icons/brand.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Brand Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_brand = icons | expand_aliases | category:"Brand Icons" | sort_by:'id' %}
+
+ {% for icon in icons_brand %}
+
{% endfor %}
diff --git a/build/_includes/icons/currency.html b/build/_includes/icons/currency.html
index a043bcc24..c4fbf02d1 100644
--- a/build/_includes/icons/currency.html
+++ b/build/_includes/icons/currency.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Currency Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_currency = icons | expand_aliases | category:"Currency Icons" | sort_by:'id' %}
+
+ {% for icon in icons_currency %}
+
{% endfor %}
diff --git a/build/_includes/icons/directional.html b/build/_includes/icons/directional.html
index 48f21dad5..c2a40ad38 100644
--- a/build/_includes/icons/directional.html
+++ b/build/_includes/icons/directional.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Directional Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_directional = icons | expand_aliases | category:"Directional Icons" | sort_by:'id' %}
+
+ {% for icon in icons_directional %}
+
{% endfor %}
diff --git a/build/_includes/icons/medical.html b/build/_includes/icons/medical.html
index 3e1298f3d..d0aed5211 100644
--- a/build/_includes/icons/medical.html
+++ b/build/_includes/icons/medical.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Medical Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_medical = icons | expand_aliases | category:"Medical Icons" | sort_by:'id' %}
+
+ {% for icon in icons_medical %}
+
{% endfor %}
diff --git a/build/_includes/icons/new.html b/build/_includes/icons/new.html
index ebb2bb961..9b7fe286f 100644
--- a/build/_includes/icons/new.html
+++ b/build/_includes/icons/new.html
@@ -8,12 +8,10 @@
{% endif %}
- {% assign icons_new = icons | version:site.fontawesome.version %}
+ {% assign icons_new = icons | expand_aliases | version:site.fontawesome.version | sort_by:'id' %}
+
{% for icon in icons_new %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
+
{% endfor %}
diff --git a/build/_includes/icons/text-editor.html b/build/_includes/icons/text-editor.html
index c16d2ae57..6a0aa8e27 100644
--- a/build/_includes/icons/text-editor.html
+++ b/build/_includes/icons/text-editor.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Text Editor Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_text_editor = icons | expand_aliases | category:"Text Editor Icons" | sort_by:'id' %}
+
+ {% for icon in icons_text_editor %}
+
{% endfor %}
diff --git a/build/_includes/icons/video-player.html b/build/_includes/icons/video-player.html
index 90ef907b7..3f65957f2 100644
--- a/build/_includes/icons/video-player.html
+++ b/build/_includes/icons/video-player.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Video Player Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_video_player = icons | expand_aliases | category:"Video Player Icons" | sort_by:'id' %}
+
+ {% for icon in icons_video_player %}
+
{% endfor %}
diff --git a/build/_includes/icons/web-application.html b/build/_includes/icons/web-application.html
index 836630a28..93c88776f 100644
--- a/build/_includes/icons/web-application.html
+++ b/build/_includes/icons/web-application.html
@@ -2,13 +2,10 @@
- {% for icon in icons %}
- {% if icon.categories contains "Web Application Icons" %}
-
- {% for alias in icon.aliases %}
-
- {% endfor %}
- {% endif %}
+ {% assign icons_web_application = icons | expand_aliases | category:"Web Application Icons" | sort_by:'id' %}
+
+ {% for icon in icons_web_application %}
+
{% endfor %}
diff --git a/build/_layouts/icon.html b/build/_layouts/icon.html
old mode 100755
new mode 100644
diff --git a/build/_plugins/icon_page_generator.rb b/build/_plugins/icon_page_generator.rb
old mode 100755
new mode 100644
diff --git a/build/_plugins/site.rb b/build/_plugins/site.rb
index 10df997c1..a6a74b7bb 100644
--- a/build/_plugins/site.rb
+++ b/build/_plugins/site.rb
@@ -13,8 +13,14 @@ module Jekyll
def initialize(icon_object)
@icon_object = icon_object
+ # Class name used in CSS and HTML
+ @icon_object['class'] = icon_object['id']
+ # Normalize the aliases
+ @icon_object['aliases'] ||= []
+
@name = icon_object['name']
@id = icon_object['id']
+ @class = icon_object['class']
@aliases = icon_object['aliases']
@unicode = icon_object['unicode']
@created = icon_object['created']
@@ -56,6 +62,25 @@ module Jekyll
end
module IconFilters
+ def expand_aliases(icons)
+ expanded = []
+
+ icons.each { |icon|
+ # Remove the aliases since we are expanding them
+ expanded << icon.reject{ |k| k == 'aliases'}
+
+ icon['aliases'].each { |alias_id|
+ alias_icon = expanded[-1].dup
+ alias_icon['class'] = alias_id
+ alias_icon['alias_of'] = icon
+
+ expanded << alias_icon
+ }
+ }
+
+ return expanded
+ end
+
def category(icons, cat)
icons.select { |icon| icon['categories'].include?(cat) }
end
@@ -63,6 +88,10 @@ module Jekyll
def version(icons, version)
icons.select { |icon| icon['created'] == version }
end
+
+ def sort_by(icons, sort_key)
+ icons.sort_by! { |icon| icon[sort_key] }
+ end
end
Liquid::Template.register_filter(IconFilters)