aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Rude <[email protected]>2019-10-08 21:01:52 +0000
committerMatt Rude <[email protected]>2019-10-08 21:01:52 +0000
commit586492ed8781c501e95f46f241fa7f3bd1d0264e (patch)
treef6b7ee58e307cc91081efa9e322998d36bd2d585
parentf105b573fce24717fea3f9f1267e31b0656a0438 (diff)
downloadtherudes_com-586492ed8781c501e95f46f241fa7f3bd1d0264e.tar.gz
therudes_com-586492ed8781c501e95f46f241fa7f3bd1d0264e.tar.bz2
therudes_com-586492ed8781c501e95f46f241fa7f3bd1d0264e.zip
Adding image resizing to size
-rw-r--r--.gitignore1
-rw-r--r--Gemfile1
-rw-r--r--_config.yml11
-rw-r--r--_includes/photo.html7
-rw-r--r--_includes/responsive-image.html6
5 files changed, 24 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index ba63053..3db36b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ _site
.jekyll-metadata
.sass-cache
Gemfile.lock
+assets/resized/*
diff --git a/Gemfile b/Gemfile
index a2ebb1a..85756dd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,6 +5,7 @@ gem 'jekyll'
gem 'execjs'
gem 'therubyracer'
gem 'jekyll-watch'
+gem 'jekyll-responsive-image'
gem 'jekyll-paginate-v2'
gem 'jekyll-minifier'
gem 'jekyll-sitemap'
diff --git a/_config.yml b/_config.yml
index e2b800f..42fcd65 100644
--- a/_config.yml
+++ b/_config.yml
@@ -24,10 +24,19 @@ exclude:
- LICENSE
- README.md
-#plugins:
+plugins:
+- jekyll-responsive-image
#- jekyll-minifier
#- jekyll-sitemap
+responsive_image:
+ template: _includes/responsive-image.html
+ default_quality: 90
+ sizes:
+ - width: 920
+ strip: true
+ cache: true
+
#jekyll-minifier:
# exclude:
# - robots.txt
diff --git a/_includes/photo.html b/_includes/photo.html
index 85d4585..307284d 100644
--- a/_includes/photo.html
+++ b/_includes/photo.html
@@ -15,7 +15,12 @@
<div class="tab-content">
{% for photo in site.data.photos %}
<div role="tabpanel" class="tab-pane {% if forloop.first %}active{% endif %}" id="{{ photo.year }}">
- <img src="/assets/img/family-photos/{{ photo.image }}" class="img-responsive" alt="Responsive image" style="width:80%">
+ {% responsive_image_block %}
+ path: assets/img/family-photos/{{ photo.image }}
+ class: "img-responsive"
+ alt: "{{ item.year }}"
+ title: "{{ item.year }}"
+ {% endresponsive_image_block %}
{% if photo.discription %}
<div>
<h2>{{ photo.title }}</h2>
diff --git a/_includes/responsive-image.html b/_includes/responsive-image.html
new file mode 100644
index 0000000..d81ff1f
--- /dev/null
+++ b/_includes/responsive-image.html
@@ -0,0 +1,6 @@
+<picture>
+ {% for i in resized %}
+ <source media="(min-width: {{ i.width }}px)" srcset="/{{ i.path }}">
+ {% endfor %}
+ <img src="/{{ path }}">
+</picture>