This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function imageType(format) { | |
switch (format.toUpperCase()) { | |
case "JPEG": | |
case "JPG": | |
return { format: "JPEG", ext: "jpg", mimetype: "image/jpeg" } | |
case "PNG": | |
return { format: "PNG", ext: "png", mimetype: "image/png" } | |
case "GIF": | |
return { format: "GIF", ext: "gif", mimetype: "image/gif" } | |
case "SVG": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign heading_level = "2" %} | |
{% assign opening_tag = "<h" | append: heading_level %} | |
{% assign closing_tag = "</h" | append: heading_level | append: ">" %} | |
{% assign toc = content | split: opening_tag %} | |
<nav class="page-toc"> | |
<ol> | |
{% for item in toc %} | |
{% if item contains closing_tag %} | |
{% assign tag = item | split: closing_tag | first | strip %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
--- | |
<ul> | |
{% assign collection = site.collections | where: 'label', 'uploads' | first %} | |
{% for file in collection.files %} | |
{% assign extension = file.extname | downcase %} | |
{% case extension %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if object == nil %} | |
object is nil | |
{% elsif object == true or object == false %} | |
object is a boolean | |
{% elsif object.first %} | |
object is an array | |
{% else %} | |
{% assign number_test = object | divided_by: 1.0 %} | |
{% if object == number_test %} | |
object is a number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function responsifyEmbeds() { | |
var iframes = document.getElementsByTagName("iframe"); | |
for (var i = 0; i < iframes.length; i++) { | |
var iframe = iframes[i]; | |
var parent = iframe.parentNode; | |
var wrapper, width, height; | |
// ignore iframes with "100%" width (those are presumed to be responsive enough already) | |
if (iframe.getAttribute("width") !== "100%") { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*, | |
*:before, | |
*:after { | |
box-sizing: border-box; | |
} | |
body { | |
font: 18px/1.5 -apple-system, sans-serif; | |
font-kerning: normal; | |
text-rendering: optimizeLegibility; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.grid-container { | |
display: grid; | |
grid-gap: 1em; | |
// set the number of columns explicitly: | |
grid-template-columns: repeat(4, 1fr); | |
// or set the number of columns based on minimum element width: | |
grid-template-columns: repeat(auto-fill, minmax(16em, 1fr)); | |
// the magic trick! this fills up gaps automatically when some items are larger than others: | |
grid-auto-flow: dense; | |
} |