Skip to content

Instantly share code, notes, and snippets.

View bobdenotter's full-sized avatar
🛠️
"Design is how it works, not how it looks."

Bob den Otter bobdenotter

🛠️
"Design is how it works, not how it looks."
  • Two Kings
  • The Hague, Netherlands
View GitHub Profile
@bobdenotter
bobdenotter / composer.json
Created December 11, 2012 17:29
Bare bones example of broken {{ render() }}
{
"require": {
"silex/silex": "1.0.*@dev",
"twig/twig": ">=1.8,<2.0-dev",
"symfony/twig-bridge": "2.1.*"
},
"minimum-stability": "dev"
}
{
"require": {
"silex/silex": "1.0.*@dev"
}
}
@bobdenotter
bobdenotter / related.twig
Last active December 13, 2015 21:48
Bolt: Get 'related records' from a content type, but only display the ones with a 'datetime' that's after today.
@bobdenotter
bobdenotter / gist:4980044
Created February 18, 2013 19:42
Bolt: When looping over an array to create a list, give the <li> classes like 'first', 'last', 'odd' and 'even'.
<ul>
{% for record in records %}
<li class="{% if loop.first %}first {% endif %}{% if loop.last %}last {% endif %} {{ cycle(["even", "odd"], loop.index) }}">
<a href="{{ record.link }}">{{ record.title }}</a>
</li>
{% endfor %}
</ul>
tags:
slug: tags
singular_slug: tag
behaves_like: tags
categories:
slug: categories
singular_slug: category
behaves_like: categories
multiple: 1
All Taxomomies:
{% if record.taxonomy is defined %}
{% for type, values in record.taxonomy %}
<em>{{ type }}:</em>
{% for link, value in values %}
<a href="{{ link }}"></a>
{% if not loop.last %}, {% endif %}
{% endfor %}
{% if not loop.last %} - {% endif %}
{% endfor %}
@bobdenotter
bobdenotter / menu.yml
Last active December 14, 2015 12:59
#bolt
main:
- label: Home
title: First menu item.
path: homepage
class: first
- label: Second item
path: entry/1
submenu:
- label: Sub 1
path: entry/2
entries:
name: Entries
singular_name: Entry
fields:
title:
type: text
class: large
slug:
type: slug
uses: title
@bobdenotter
bobdenotter / related.twig
Last active December 14, 2015 13:08
#bolt
@bobdenotter
bobdenotter / setcontent.twig
Last active December 14, 2015 14:18
#bolt
{% setcontent records = "entries/latest/10" allowpaging %}
{% for record in records %}
<article>
<div class="imageholder"><a href="{{ image(record.image) }}">
<img src="{{ thumbnail(record.image, 400, 260) }}">
</a></div>
<h3><a href="{{ record.link }}">{{ record.title }}</a></h3>
<p>{{ record.excerpt(220) }}</p>