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 / _config.yml
Last active December 18, 2016 02:59
Custom Posts permalink in Jekyll
collections:
posts:
title: "Articles" # replace "Articles" with name of your choice
output: true
defaults:
- scope:
path: ''
type: posts
values:
@sskylar
sskylar / _config.yml
Last active May 23, 2016 21:49
Apply defaults to documents in a Jekyll collection
defaults:
-
scope:
path: "" # an empty string here means all files
type: "my_collection" # applies defaults only to documents in this collection (e.g. "posts")
values:
layout: "default"
foo: "bar" # any metadata fields can go here
@sskylar
sskylar / form.html
Created July 21, 2015 14:04
Formspree + Siteleaf metadata
<form action="//formspree.io/{{ site.meta.contact_email }}" method="POST">
<input type="email" name="_replyto" placeholder="Your email">
<textarea name="message" rows="5" placeholder="Your message"></textarea>
<input type="submit" value="Send">
</form>
@sskylar
sskylar / image-styles-siteleaf.md
Last active August 29, 2015 14:23
Using asset metadata to style images in Siteleaf

To style assets in Siteleaf you can use asset metadata. For example, you can create a meta field called css_class on your asset.

Now in your theme code you can write:

{% for asset in assets %}
  <img src="{{asset.url}}" class="{{asset.meta.css_class}}">
{% endfor %}
@sskylar
sskylar / image-styles.md
Last active July 5, 2024 00:12
Styling images using Markdown and CSS

Here are two ways to style images using Markdown

1. Using class names

If you'd like to use classes, HTML is completely valid in Markdown:

<span class="right">
![](/assets/image.jpg) 
{% unless slug == 'about' %}
<img src="{{meta['featured-icon']}}" alt="featured icon" class="featured-icon">
{% endunless%}
@sskylar
sskylar / depth.html
Created April 3, 2015 20:41
Determine page depth in Siteleaf
<body class="level{{ url | remove_first:'/' | split:'/' | size }}">
...
</body>
@sskylar
sskylar / ping.rb
Last active August 29, 2015 14:18
Ping Siteleaf API with cURL or Ruby Gem
require 'siteleaf'
Siteleaf.api_key = 'key'
Siteleaf.api_secret = 'secret'
Siteleaf::Client.get('ping')
@sskylar
sskylar / section.html
Created March 27, 2015 15:45
Get top-level page slug from nested post/subpage url in Siteleaf
{% assign section = url | remove_first:'/' | split:'/' | first %}
@sskylar
sskylar / long_page.html
Last active August 29, 2015 14:16
Long page in Siteleaf with multiple content sections and sub-sections
<h1>{{title}}</h1>
{{body}}
{% for section in pages %}
<h2 id="{{section.slug}}">{{section.title}}</h2>
{{section.body}}
{% for subsection in section.pages %}