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-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),

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-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 %}
@budparr
budparr / jekyll-layout-default
Created December 2, 2014 13:09
Default basic layout for a Jekyll site
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include header.html %}
<div class="page-content">
@budparr
budparr / jekyll-layout-post
Last active March 20, 2018 15:02
Basic Jekyll layout for posts
---
layout: default
---
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>
<article class="post-content">
@budparr
budparr / jekyll-collections-prev-next.html
Last active September 29, 2021 10:55
Previous Next Links for Jekyll Collections
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if links.title == page.title %}
{% unless forloop.first %}
{% assign prevurl = prev.url %}
{% endunless %}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Simple, single configuration file to override almost all paths and server settings. As used by @airways
// and @litzinger.
// Only check in the default as dist.config.php, set your version control system to ignore config.php so that
// local users and each instance (staging, production) can have their own settings.
// These config files are mainly meant to be used on a shared development server used by all developers,
// although it works almost as well for local development as well.
@budparr
budparr / webhook-robots.txt
Created January 12, 2015 17:34
Webhook robots.txt file
User-Agent: *
Disallow:{% if getSetting('analytics_id') %} /cms/{% else %} /{% endif %}
@budparr
budparr / serial-comma-swig
Created January 30, 2015 23:58
Serial comma with Swig Templating Language: "x and y" or "x, y, and z" (not url specific to Webhook)
<a href="{{ url(object) }}">{{ object.name }}</a>{% if loop.revindex != 2 %}{% if not loop.last %}, {% endif %}{% endif %}{% if loop.revindex == 2 %} and {% endif %}
@budparr
budparr / gitignore
Created March 8, 2015 22:48
Basic gitignore for Webhook
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
.DS_Store
.sass-cache