Skip to content

Commit 659f13d

Browse files
use cloudinary to crop blog images
1 parent 6504783 commit 659f13d

File tree

9 files changed

+1694
-24
lines changed

9 files changed

+1694
-24
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
title: Oxfordshire <br/>Community <br/>Land Trust
22

33
gcaptcha: "6LdNn1AUAAAAAA-VLy7CCzufqQi7EhPyoWQwcHIM"
4+
cloudinary: letsdance
45

56
# # # Where things are
67
source: .

_config_dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
baseurl: ""
2+
local: true

_data/mix-manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"/js/app.js": "/js/app.js?id=fcbbf91c150350cdef21",
3-
"/css/app.css": "/css/app.css?id=818cb6c180f40cb55d86",
4-
"/fonts/aleo-bold-webfont.woff": "/fonts/aleo-bold-webfont.woff?id=df10567c62c691182479",
5-
"/fonts/aleo-bold-webfont.woff2": "/fonts/aleo-bold-webfont.woff2?id=6985981fe1ac48952d14",
6-
"/fonts/neue_hans_kendrick_bold.woff": "/fonts/neue_hans_kendrick_bold.woff?id=c4a6651453072a52d8ed",
7-
"/fonts/neue_hans_kendrick_bold.woff2": "/fonts/neue_hans_kendrick_bold.woff2?id=dfc01f1ac04cc2ecd40e",
8-
"/fonts/neue_hans_kendrick_regular.woff": "/fonts/neue_hans_kendrick_regular.woff?id=1018b5903d88ea0e6915",
9-
"/fonts/neue_hans_kendrick_regular.woff2": "/fonts/neue_hans_kendrick_regular.woff2?id=247b34e2484a4471d10b",
10-
"/images/arrow-right.svg": "/images/arrow-right.svg?id=0e7de36dbe8af3bd4f56",
11-
"/images/countryside.jpg": "/images/countryside.jpg?id=2e766d120c08ed4f0027"
2+
"/js/app.js": "/js/app.js",
3+
"/css/app.css": "/css/app.css",
4+
"/fonts/aleo-bold-webfont.woff": "/fonts/aleo-bold-webfont.woff",
5+
"/fonts/aleo-bold-webfont.woff2": "/fonts/aleo-bold-webfont.woff2",
6+
"/fonts/neue_hans_kendrick_bold.woff": "/fonts/neue_hans_kendrick_bold.woff",
7+
"/fonts/neue_hans_kendrick_bold.woff2": "/fonts/neue_hans_kendrick_bold.woff2",
8+
"/fonts/neue_hans_kendrick_regular.woff": "/fonts/neue_hans_kendrick_regular.woff",
9+
"/fonts/neue_hans_kendrick_regular.woff2": "/fonts/neue_hans_kendrick_regular.woff2",
10+
"/images/arrow-right.svg": "/images/arrow-right.svg",
11+
"/images/countryside.jpg": "/images/countryside.jpg"
1212
}

_includes/cloudinary.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% capture img_output %}
2+
{% if site.local != true %}
3+
{% if include.pathonly != 'true' %}<img alt="" src="{% endif %}
4+
//res.cloudinary.com/{{ site.cloudinary }}/image/fetch/w_{{ include.width | default: "500"}},h_{{ include.height | default: "500"}}{{ include.quality | prepend: ",q_"}}{{ include.modes| default: "c_fill" | prepend: "," }}/{{ site.url }}{{ site.baseurl }}{{ include.img }}
5+
{% if include.pathonly != 'true' %}" width="{{ include.width | default: 500 }}" height="{{ include.height | default: 500}}" />{% endif %}
6+
{% else %}
7+
{% if include.pathonly != 'true' %}<img alt="" src="{% endif %}{{ site.baseurl }}{{ include.img }}{% if include.pathonly != 'true' %} "/>{% endif %}
8+
{% endif %}
9+
{% endcapture %}{{ img_output | strip_newlines }}

_includes/components/home-blog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2 class="section-heading">{{ include.title | default: 'Blog' }}</h2>
44
{% for post in site.posts limit:3 %}
55
<a href="{% if post.external_link %}{{ post.external_link }}{% else %}{{ post.url }}{% endif %}" class="home-blog--item" data-aos="fade-up" data-aos-ratio=".25" data-aos-delay="{{ forloop.index | minus: 1 | times:200 }}">
66
<div class="home-blog--item--image">
7-
<img src="{{ post.image }}" alt=""/>
7+
{% include cloudinary.html img=post.image width="400" height="400" modes="c_fill,g_face,e_sharpen" quality="85" %}
88
</div>
99
<div class="home-blog--item--text">
1010
<h3 class="home-blog--item--title">{{ post.title }}</h3>

assets/css/app.css

Lines changed: 1510 additions & 1 deletion
Large diffs are not rendered by default.

assets/js/app.js

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,150 @@
1-
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/",t(t.s=0)}({0:function(e,n,t){t("hghA"),e.exports=t("Ql/l")},"Ql/l":function(e,n){var t;t=document.querySelectorAll(".section--home-faqs h3"),Array.prototype.forEach.call(t,function(e){e.innerHTML='\n <button aria-expanded="false">\n '+e.textContent+'\n <svg aria-hidden="true" focusable="false" viewBox="0 0 14 30">\n <path fill="#53C5BD" d="M13.9 14.9c0 .3-.1.7-.3.9l-11 13.5c-.5.6-1.4.7-2.1.2-.6-.5-.7-1.4-.2-2.1l10.2-12.5L.3 2.4C-.2 1.8-.1.9.5.3 1.1-.2 2-.1 2.6.5l11 13.5c.2.3.3.6.3.9z"/>\n </svg>\n </button>\n ';var n=function(e){for(var n=[];e.nextElementSibling&&"H3"!==e.nextElementSibling.tagName;)n.push(e.nextElementSibling),e=e.nextElementSibling;return n.forEach(function(e){e.parentNode.removeChild(e)}),n}(e),r=document.createElement("div");r.hidden=!0,n.forEach(function(e){r.appendChild(e)}),e.parentNode.insertBefore(r,e.nextElementSibling);var o=e.querySelector("button");o.onclick=function(){var e="true"===o.getAttribute("aria-expanded")||!1;!1===e&&t.forEach(function(e){e.querySelector("button").setAttribute("aria-expanded",!1),e.nextElementSibling.hidden=!0}),o.setAttribute("aria-expanded",!e),r.hidden=e}})},hghA:function(e,n){}});
1+
/******/ (function(modules) { // webpackBootstrap
2+
/******/ // The module cache
3+
/******/ var installedModules = {};
4+
/******/
5+
/******/ // The require function
6+
/******/ function __webpack_require__(moduleId) {
7+
/******/
8+
/******/ // Check if module is in cache
9+
/******/ if(installedModules[moduleId]) {
10+
/******/ return installedModules[moduleId].exports;
11+
/******/ }
12+
/******/ // Create a new module (and put it into the cache)
13+
/******/ var module = installedModules[moduleId] = {
14+
/******/ i: moduleId,
15+
/******/ l: false,
16+
/******/ exports: {}
17+
/******/ };
18+
/******/
19+
/******/ // Execute the module function
20+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21+
/******/
22+
/******/ // Flag the module as loaded
23+
/******/ module.l = true;
24+
/******/
25+
/******/ // Return the exports of the module
26+
/******/ return module.exports;
27+
/******/ }
28+
/******/
29+
/******/
30+
/******/ // expose the modules object (__webpack_modules__)
31+
/******/ __webpack_require__.m = modules;
32+
/******/
33+
/******/ // expose the module cache
34+
/******/ __webpack_require__.c = installedModules;
35+
/******/
36+
/******/ // define getter function for harmony exports
37+
/******/ __webpack_require__.d = function(exports, name, getter) {
38+
/******/ if(!__webpack_require__.o(exports, name)) {
39+
/******/ Object.defineProperty(exports, name, {
40+
/******/ configurable: false,
41+
/******/ enumerable: true,
42+
/******/ get: getter
43+
/******/ });
44+
/******/ }
45+
/******/ };
46+
/******/
47+
/******/ // getDefaultExport function for compatibility with non-harmony modules
48+
/******/ __webpack_require__.n = function(module) {
49+
/******/ var getter = module && module.__esModule ?
50+
/******/ function getDefault() { return module['default']; } :
51+
/******/ function getModuleExports() { return module; };
52+
/******/ __webpack_require__.d(getter, 'a', getter);
53+
/******/ return getter;
54+
/******/ };
55+
/******/
56+
/******/ // Object.prototype.hasOwnProperty.call
57+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58+
/******/
59+
/******/ // __webpack_public_path__
60+
/******/ __webpack_require__.p = "/";
61+
/******/
62+
/******/ // Load entry module and return exports
63+
/******/ return __webpack_require__(__webpack_require__.s = 0);
64+
/******/ })
65+
/************************************************************************/
66+
/******/ ([
67+
/* 0 */
68+
/***/ (function(module, exports, __webpack_require__) {
69+
70+
__webpack_require__(1);
71+
module.exports = __webpack_require__(2);
72+
73+
74+
/***/ }),
75+
/* 1 */
76+
/***/ (function(module, exports) {
77+
78+
// removed by extract-text-webpack-plugin
79+
80+
/***/ }),
81+
/* 2 */
82+
/***/ (function(module, exports) {
83+
84+
(function () {
85+
// Get all the <h3> headings
86+
var headings = document.querySelectorAll('.section--home-faqs h3');
87+
88+
Array.prototype.forEach.call(headings, function (heading) {
89+
// Give each <h3> a toggle button child
90+
// with the SVG plus/minus icon
91+
heading.innerHTML = '\n <button aria-expanded="false">\n ' + heading.textContent + '\n <svg aria-hidden="true" focusable="false" viewBox="0 0 14 30">\n <path fill="#53C5BD" d="M13.9 14.9c0 .3-.1.7-.3.9l-11 13.5c-.5.6-1.4.7-2.1.2-.6-.5-.7-1.4-.2-2.1l10.2-12.5L.3 2.4C-.2 1.8-.1.9.5.3 1.1-.2 2-.1 2.6.5l11 13.5c.2.3.3.6.3.9z"/>\n </svg>\n </button>\n ';
92+
93+
// Function to create a node list
94+
// of the content between this <h3> and the next
95+
var getContent = function getContent(elem) {
96+
var elems = [];
97+
while (elem.nextElementSibling && elem.nextElementSibling.tagName !== 'H3') {
98+
elems.push(elem.nextElementSibling);
99+
elem = elem.nextElementSibling;
100+
}
101+
102+
// Delete the old versions of the content nodes
103+
elems.forEach(function (node) {
104+
node.parentNode.removeChild(node);
105+
});
106+
107+
return elems;
108+
};
109+
110+
// Assign the contents to be expanded/collapsed (array)
111+
var contents = getContent(heading);
112+
113+
// Create a wrapper element for `contents` and hide it
114+
var wrapper = document.createElement('div');
115+
wrapper.hidden = true;
116+
117+
// Add each element of `contents` to `wrapper`
118+
contents.forEach(function (node) {
119+
wrapper.appendChild(node);
120+
});
121+
122+
// Add the wrapped content back into the DOM
123+
// after the heading
124+
heading.parentNode.insertBefore(wrapper, heading.nextElementSibling);
125+
126+
// Assign the button
127+
var btn = heading.querySelector('button');
128+
129+
btn.onclick = function () {
130+
// Cast the state as a boolean
131+
var expanded = btn.getAttribute('aria-expanded') === 'true' || false;
132+
133+
// Switch the state
134+
if (expanded === false) {
135+
headings.forEach(function (heading) {
136+
heading.querySelector('button').setAttribute('aria-expanded', false);
137+
heading.nextElementSibling.hidden = true;
138+
});
139+
}
140+
141+
btn.setAttribute('aria-expanded', !expanded);
142+
wrapper.hidden = expanded;
143+
144+
// Switch the content's visibility
145+
};
146+
});
147+
})();
148+
149+
/***/ })
150+
/******/ ]);

assets/mix-manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"/js/app.js": "/js/app.js?id=fcbbf91c150350cdef21",
3-
"/css/app.css": "/css/app.css?id=818cb6c180f40cb55d86",
4-
"/fonts/aleo-bold-webfont.woff": "/fonts/aleo-bold-webfont.woff?id=df10567c62c691182479",
5-
"/fonts/aleo-bold-webfont.woff2": "/fonts/aleo-bold-webfont.woff2?id=6985981fe1ac48952d14",
6-
"/fonts/neue_hans_kendrick_bold.woff": "/fonts/neue_hans_kendrick_bold.woff?id=c4a6651453072a52d8ed",
7-
"/fonts/neue_hans_kendrick_bold.woff2": "/fonts/neue_hans_kendrick_bold.woff2?id=dfc01f1ac04cc2ecd40e",
8-
"/fonts/neue_hans_kendrick_regular.woff": "/fonts/neue_hans_kendrick_regular.woff?id=1018b5903d88ea0e6915",
9-
"/fonts/neue_hans_kendrick_regular.woff2": "/fonts/neue_hans_kendrick_regular.woff2?id=247b34e2484a4471d10b",
10-
"/images/arrow-right.svg": "/images/arrow-right.svg?id=0e7de36dbe8af3bd4f56",
11-
"/images/countryside.jpg": "/images/countryside.jpg?id=2e766d120c08ed4f0027"
2+
"/js/app.js": "/js/app.js",
3+
"/css/app.css": "/css/app.css",
4+
"/fonts/aleo-bold-webfont.woff": "/fonts/aleo-bold-webfont.woff",
5+
"/fonts/aleo-bold-webfont.woff2": "/fonts/aleo-bold-webfont.woff2",
6+
"/fonts/neue_hans_kendrick_bold.woff": "/fonts/neue_hans_kendrick_bold.woff",
7+
"/fonts/neue_hans_kendrick_bold.woff2": "/fonts/neue_hans_kendrick_bold.woff2",
8+
"/fonts/neue_hans_kendrick_regular.woff": "/fonts/neue_hans_kendrick_regular.woff",
9+
"/fonts/neue_hans_kendrick_regular.woff2": "/fonts/neue_hans_kendrick_regular.woff2",
10+
"/images/arrow-right.svg": "/images/arrow-right.svg",
11+
"/images/countryside.jpg": "/images/countryside.jpg"
1212
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js & bundle exec jekyll build --watch",
7+
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js & bundle exec jekyll build --watch --config _config.yml,_config_dev.yml",
88
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js && bundle exec jekyll build"
99
},
1010
"keywords": [],

0 commit comments

Comments
 (0)