Skip to content

Instantly share code, notes, and snippets.

View sskylar's full-sized avatar
lgtm

Skylar SC sskylar

lgtm
View GitHub Profile
@sskylar
sskylar / resrc.html
Created October 15, 2014 21:28
Using ReSRC.it with Siteleaf
<img src="{{ asset.url }}" class="resrc"/>
<script src="//use.resrc.it/0.9"></script>
<script>
resrc.ready(function () {
resrc.run();
});
</script>
@sskylar
sskylar / imgix.html
Created October 15, 2014 21:19
Using imgix with Siteleaf
{{ asset.url | prepend:'//you.imgix.net' | append:'?w=500&h=500' }}
@sskylar
sskylar / find_meta.html
Created October 13, 2014 16:35
Find post in Siteleaf based on meta value
{% for post in posts %}
{% if post.meta['KEY'].value == 'VALUE' %}
<p>Post found: {{post.title}}</p>
{% break %}
{% endfor %}
{% endfor %}
@sskylar
sskylar / dump.json.liquid
Created October 8, 2014 04:41
Siteleaf site in JSON format
{
"site": {{ site | json }},
"pages": {{ site.pages | json }},
"posts": {{ site.posts | json }}
}
@sskylar
sskylar / index.html
Last active August 28, 2018 18:28
Simple password protection using a md5 hashed slug in Siteleaf (note: this is not intended for high security, only to stop casual visitors)
<form>
<input id="password" type="password"/>
<button>Submit</button>
</form>
@sskylar
sskylar / default.html
Created July 15, 2014 16:09
Redirect page/post in Siteleaf, set destination URL in a meta field called "redirect"
<!doctype html>
<html>
<head>
{% if meta.redirect %}
<meta http-equiv="refresh" content="0;url={{meta.redirect}}">
{% endif %}
</head>
<body>
</body>
</html>
@sskylar
sskylar / related.json.liquid
Created July 3, 2014 16:09
Dynamic related posts in Siteleaf using JSON
@sskylar
sskylar / dropdown-nav.html
Last active July 10, 2018 21:17
Drop-down nav for Siteleaf v1 using Liquid
{% for page in site.pages %}
<li {% if page.pages.size > 1 %}class="has-dropdown"{% endif %}>
<a href="{{page.url}}"{% if page.url == url %} class="active"{% endif %}>{{page.title}}</a>
{% if page.pages.size > 1 %}
<ul class="dropdown">
{% for subpage in page.pages %}
<li><a href="{{subpage.url}}"{% if subpage.url == url %} class="active"{% endif %}>{{subpage.title}}</a></li>
{% endfor %}
</ul>
{% endif %}
@sskylar
sskylar / featured.html
Created June 27, 2014 05:33
Group a limited number of featured posts in Siteleaf using Liquid.
@sskylar
sskylar / posts-by-tag.html
Created June 9, 2014 16:57
Group posts by tag and sort alphabetically in Siteleaf
{% for tag in taxonomy['tags'] %}
<h1>{{tag}}</h1>
<ul>
{% assign sorted_posts = tag.posts.all | sort:'title' %}
{% for post in sorted_posts %}
<li>{{post.title}}</li>
{% endfor %}
</ul>
{% endfor %}