From f895140273b521c1fcdc63b27523566057df1de6 Mon Sep 17 00:00:00 2001 From: codecalm Date: Sun, 29 Dec 2019 16:05:13 +0100 Subject: [PATCH] sitamap, music components, ui fixes --- pages/_includes/cards/music/track-info.html | 19 ++++++++++ pages/_includes/cards/music/tracks-list.html | 33 +++++++++++++++++ pages/_plugins/jekyll-filters.rb | 13 +++++++ pages/music.html | 19 +++++++--- pages/sitemap.xml | 39 ++++++++++++++++++++ scss/ui/_cards.scss | 1 - 6 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 pages/_includes/cards/music/track-info.html create mode 100644 pages/_includes/cards/music/tracks-list.html create mode 100644 pages/sitemap.xml diff --git a/pages/_includes/cards/music/track-info.html b/pages/_includes/cards/music/track-info.html new file mode 100644 index 000000000..90933fe5a --- /dev/null +++ b/pages/_includes/cards/music/track-info.html @@ -0,0 +1,19 @@ +{% assign track-id = include.track-id | default: 5 %} +{% assign track = site.data.tracks[track-id] %} +
+
+
+ {{ track.name | escape }} +
+
+
+ {{ track.name }} +
+ {% for artist in track.artists %} + {{ artist.name }}{% unless forloop.last %},{% endunless %} + {% endfor %} +
+
+
+
+
diff --git a/pages/_includes/cards/music/tracks-list.html b/pages/_includes/cards/music/tracks-list.html new file mode 100644 index 000000000..8edb59dfa --- /dev/null +++ b/pages/_includes/cards/music/tracks-list.html @@ -0,0 +1,33 @@ +
+
+ {% for track in site.data.tracks limit: 12 %} +
+
+
+ {{ forloop.index }} +
+
+ {{ track.name | escape }} +
+
+ {{ track.name }} +
+ {% for artist in track.artists %} + {{ artist.name }}{% unless forloop.last %},{% endunless %} + {% endfor %} +
+
+
+ {{ track.duration_ms | miliseconds_to_minutes }} +
+
+ {% include_cached ui/icon.html icon="heart" %} +
+
+ {% include_cached ui/icon.html icon="more-horizontal" %} +
+
+
+ {% endfor %} +
+
diff --git a/pages/_plugins/jekyll-filters.rb b/pages/_plugins/jekyll-filters.rb index a57747b39..74536ef3f 100644 --- a/pages/_plugins/jekyll-filters.rb +++ b/pages/_plugins/jekyll-filters.rb @@ -96,6 +96,19 @@ module Jekyll Jekyll.sites.first.data['colors'][color] end + def seconds_to_minutes(seconds) + p "seconds_to_minutes" + seconds = seconds.to_i.round + + minutes = (seconds / 60).round + seconds = seconds - (minutes * 60) + + minutes.to_s.rjust(2, '0') + ":" + seconds.to_s.rjust(2, '0') + end + + def miliseconds_to_minutes(miliseconds) + seconds_to_minutes(miliseconds.to_i / 1000) + end end end diff --git a/pages/music.html b/pages/music.html index 688baac0a..75e714a6c 100644 --- a/pages/music.html +++ b/pages/music.html @@ -4,10 +4,19 @@ page-title: Music components menu: base.music --- -
- {% for track in site.data.tracks %} -
- {{ track.name }} +
+
+ {% include_cached cards/music/tracks-list.html %} +
+
+

Top tracks

+ +
+ {% for i in (8..13) %} +
+ {% include cards/music/track-info.html track-id=i %} +
+ {% endfor %}
- {% endfor %} +
diff --git a/pages/sitemap.xml b/pages/sitemap.xml new file mode 100644 index 000000000..80ce1c854 --- /dev/null +++ b/pages/sitemap.xml @@ -0,0 +1,39 @@ +--- +layout: none +--- + +{% if page.xsl %} + +{% endif %} + + {% assign collections = site.collections | where_exp:'collection','collection.output != false' %} + {% for collection in collections %} + {% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %} + {% for doc in docs %} + + {{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }} + {% if doc.last_modified_at or doc.date %} + {{ doc.last_modified_at | default: doc.date | date_to_xmlschema }} + {% endif %} + + {% endfor %} + {% endfor %} + + {% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %} + {% for page in pages %} + + {{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }} + {% if page.last_modified_at %} + {{ page.last_modified_at | date_to_xmlschema }} + {% endif %} + + {% endfor %} + + {% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %} + {% for file in static_files %} + + {{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }} + {{ file.modified_time | date_to_xmlschema }} + + {% endfor %} + diff --git a/scss/ui/_cards.scss b/scss/ui/_cards.scss index 98399d260..7529d49a3 100644 --- a/scss/ui/_cards.scss +++ b/scss/ui/_cards.scss @@ -344,7 +344,6 @@ Card list group .list-group-item { padding-right: $card-spacer-x; - padding-left: $card-spacer-x; border-right: 0; border-left: 0;