Skip to content

Instantly share code, notes, and snippets.

View edwardhorsford's full-sized avatar

Ed Horsford edwardhorsford

View GitHub Profile
@edwardhorsford
edwardhorsford / filters.js
Last active October 28, 2022 13:55
Useful Nunjucks filters for the GOV.UK Prototype Kit
/*
=====================================================================
arrayToGovukTable
Convert an array to form needed for govukTable macro
=====================================================================
Expects array or nested array.
Usage:
@edwardhorsford
edwardhorsford / next - previous.njk
Created September 7, 2018 21:40
Hacky next / previous code
{% set currentProjectIndex = 0 %}
{% set countOfProjects = collections.design.length %}
{% for project in collections.design %}
{% if project.url == page.url %}
{% set currentProjectIndex = loop.index0 %}
{% endif %}
{% endfor %}
{% set previousProjectIndex = currentProjectIndex - 1 %}
[
'07700900456', // mobile
'+447700900456',
'(+44) 07700900456',
'07700 900 456',
'07700 900456',
'+447700 900456',
'01144960573', // sheffield (4 digit area)
'+441144960573',
'+44114 4960573',
@edwardhorsford
edwardhorsford / GOV.UK service back links
Last active August 29, 2015 14:25
HTML and CSS for GOV.UK back links.
@edwardhorsford
edwardhorsford / govuk_service_email_template
Last active April 19, 2016 15:07
GOV.UK service email template
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<!-- This disables auto detection of phone numbers in some clients. Remove if not needed. -->
<meta name="format-detection" content="telephone=no">
<title>Page title</title>
</head>
<body style="font-family: Helvetica, Arial, sans-serif;font-size: 16px;margin: 0;color:#0b0c0c">
@edwardhorsford
edwardhorsford / guide-template.html
Last active August 29, 2015 14:05
The basics needed to fake a 'GOV.UK guide' in the express prototype. Hacky
{{<layout}}
{{$pageTitle}}Index{{/pageTitle}}
{{$content}}
<main id="content" role="main" class="group multi-page">
<header class="page-header group">
<div>
<h1>{{guideTitle}}</h1>
</div>