Skip to content

Instantly share code, notes, and snippets.

View budparr's full-sized avatar
🎯
Focusing

Bud Parr budparr

🎯
Focusing
View GitHub Profile
@budparr
budparr / jekyll-group_by-example.liquid
Last active January 21, 2024 11:10
Example Jekyll group_by filter #jekyllrb
{% comment %}
items is a collection, though I think it coule be any content type
{% endcomment %}
{% comment %} Create the group. {% endcomment %}
{% assign items_grouped = site.items | group_by: 'category' | sort: 'name' | reverse %}
{% comment %}
The above returns, for example, which is why we sort by 'name'
{"name"=>"category1_value", "items"=>[#, #, #, #, #]}{"name"=>"category2_value", "items"=>[#, #, #, #]}
{% endcomment %}

Versions

A "version" is described by the v2.0.0 specification found at http://semver.org/.

A leading "=" or "v" character is stripped off and ignored.

Ranges

The following range styles are supported:

@budparr
budparr / jekyll-google-analytics-tag
Created May 20, 2014 18:26
Google Analytics for Jekyll sites
in _config.yml I put
google_analytics_id: YOURID
and likely you already have url: www.example.com
Include the code below in your site header before </head>
---
{% if site.google_analytics_id %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@budparr
budparr / static-site-calendar-json
Created May 12, 2014 22:03
Jekyll JSON generator for calendar
---
layout: none
---
{"events": [{% assign first = true %}
{% for post in site.data.events reversed %}
{% if first == false %},{% endif %}
{% if first == true %}{% assign first = false %}{% endif %}
{
"name" : "{{ post.title }}",
"allday" : "{{ post.allday }}",
@budparr
budparr / static-site-calendar-yaml
Created May 12, 2014 22:02
Use this YAML so content people can easily add event listings. Convert the events into JSON and display using underscore.js and moment.js
-
title:
venue:
address:
city-state:
zip:
website:
allday: true
start: 2014-06-11 18:00:00
end: 2014-06-11 19:30:00
@budparr
budparr / calendar-for-static-sites.js
Last active August 29, 2015 14:01
A calendar solution for static sites
this is now located at: https://github.com/budparr/jekyll-calendar
// REQUIRES MOMENT.JS AND UNDERSCORE.JS
// This still needs to be templated and cleaned up and commented.
// original idea came from (I think) seattlehacks.com
// you will need to add events via a JSON file
// OR use this YAML to have content people create lists of events https://gist.github.com/budparr/5b21dccf318e723834e9
// use this JSON generator to create JSON for list below https://gist.github.com/budparr/ee901ba06f29cf1db637
var timing = function(start, end) {
@budparr
budparr / jekyll-og-meta-generator
Created April 19, 2014 00:07
Jekyll Open Graph meta-data Generator
<!-- TODO: add og, twitter card -->
{% comment %}
http://ogp.me/
{% endcomment %}
<meta name="description" content="{% if page.tagline %}{{page.tagline}}{% endif %}">
{% if page.categories %}
{% for category in page.categories limit:1 %}
<meta content="{{ category }}" property="article:section">
{% assign count = '0' %}
{% assign idx = '0' %}
{% for post in site.posts reversed %}
{% if post.series == page.series %}
{% capture count %}{{ count | plus: '1' }}{% endcapture %}
{% if post.url == page.url %}
{% capture idx %}{{count}}{% endcapture %}
{% endif %}
{% endif %}
{% endfor %}
{{ if raven:success }}
<h1>Thank You!</h1>
{{ first-name }}
{{ last-name }}
{{ from }}
{{ phone }}
{{ book-title }}
{{ book-publisher }}
{{ author-name }}