Skip to content

Commit 0ee529e

Browse files
committed
refactor: Assemble case studies from their own front matter
Generate index cards, structured data, and next links from each study's metadata. Apply a shared layout and defaults, and document the authoring workflow. Validate a clean build of the staged source, including all 11 existing published studies and their navigation cycle.
1 parent 357555c commit 0ee529e

18 files changed

Lines changed: 181 additions & 221 deletions

‎README.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,42 @@ CSS Wizardry is built on [Jekyll](https://github.com/mojombo/jekyll) and
66
[inuit.css](http://inuitcss.com), this repository houses the CSS Wizardry
77
specific source code for both.
88

9+
## Adding a Case Study
10+
11+
Create a Markdown file in `case-studies/` with its own article and card details:
12+
13+
```yaml
14+
---
15+
title: "Example: Improving Web Performance"
16+
meta: "What we improved and how it helped."
17+
permalink: /case-studies/example/
18+
client: "Example"
19+
services: "Performance Audit, Consultancy"
20+
order: 130
21+
---
22+
```
23+
24+
Jekyll adds published studies to the index and the ‘Next up’ sequence
25+
automatically. The folder supplies the layout and shared settings, so the
26+
article needs no closing navigation include. Links use the destination’s title
27+
and URL.
28+
29+
Use a unique numeric `order`, with higher numbers first. Existing studies run
30+
from `120` down to `10`; use `130` for the next one, then `140`, and so on.
31+
The sequence wraps from the last study to the first. The index shuffles its
32+
cards in the browser, while the links between studies keep their fixed order.
33+
34+
Optionally add `bg_color`, `bg_gradient`, or `title_color` for the card’s colours.
35+
Quote colour values such as `"#0072c6"`. Without these fields, the card uses the
36+
shared background and white text. Set `toc: false` to hide the article’s table
37+
of contents.
38+
39+
Set `published: false` while drafting, then remove it when the study is ready.
40+
Unpublished studies stay out of the index and the ‘Next up’ sequence, even when
41+
previewing them with `--unpublished`. The index and case studies regenerate
42+
during incremental builds so changes refresh their cards and links. Restart
43+
the preview server after changing `_config.yml`.
44+
945
Despite being open sourced, all CSS Wizardry code and content remain copyright
1046
of Harry Roberts.
1147

‎_config.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ permalink: /:year/:month/:title/
1414
paginate: 10
1515
paginate_path: "/blog/page-:num/"
1616
incremental: true
17+
defaults:
18+
- scope:
19+
path: case-studies/
20+
type: pages
21+
values:
22+
layout: case-study
23+
case-study: true
24+
hide-hire-me-link: true
25+
lux: "Case Study"
26+
regenerate: true
1727
exclude:
1828
- watch
1929
- css/watch

‎_includes/case-studies.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% assign case_studies = site.pages | where: "case-study", true | where_exp: "study", "study.published != false" | sort: "order" | reverse %}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script type=application/ld+json>
2+
{
3+
"@context": "https://schema.org",
4+
"@type": "BlogPosting",
5+
"mainEntityOfPage": {
6+
"@type": "WebPage",
7+
"@id": {{ page.url | absolute_url | jsonify }}
8+
},
9+
"headline": {{ page.title | jsonify }},
10+
"description": {{ page.meta | jsonify }},
11+
"author": {
12+
"@type": "Person",
13+
"name": "Harry Roberts",
14+
"url": {{ '/about/' | absolute_url | jsonify }}
15+
},
16+
"publisher": {
17+
"@type": "Organization",
18+
"name": "CSS Wizardry Ltd",
19+
"logo": {
20+
"@type": "ImageObject",
21+
"url": {{ '/img/csswizardry-logo.png' | absolute_url | jsonify }}
22+
}
23+
},
24+
"articleSection": "Case Study"
25+
}
26+
</script>
27+
28+
<script type=application/ld+json>
29+
{
30+
"@context": "https://schema.org",
31+
"@type": "BreadcrumbList",
32+
"itemListElement": [
33+
{
34+
"@type": "ListItem",
35+
"position": 1,
36+
"name": "Home",
37+
"item": {{ '/' | absolute_url | jsonify }}
38+
},
39+
{
40+
"@type": "ListItem",
41+
"position": 2,
42+
"name": "Case Studies",
43+
"item": {{ '/case-studies/' | absolute_url | jsonify }}
44+
},
45+
{
46+
"@type": "ListItem",
47+
"position": 3,
48+
"name": {{ page.title | jsonify }},
49+
"item": {{ page.url | absolute_url | jsonify }}
50+
}
51+
]
52+
}
53+
</script>

‎_includes/promo-next.html‎

Lines changed: 15 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,22 @@
1+
{% include case-studies.html %}
2+
{% assign next_case_study = nil %}
3+
{% if page.published != false and case_studies.size > 1 %}
4+
{% for study in case_studies %}
5+
{% if study.url == page.url %}
6+
{% assign next_case_study = case_studies[forloop.index] | default: case_studies.first %}
7+
{% break %}
8+
{% endif %}
9+
{% endfor %}
10+
{% endif %}
11+
112
<article class="[ box box--highlight ] mb" data-ui-component="Cross-sell promo">
213

14+
{% if next_case_study %}
315
<p><strong>Next up:</strong></p>
416

5-
<p><a href="{{ page.next-case-study-url }}" class="btn btn--full">{{ page.next-case-study-title }}</a></p>
17+
<p><a href="{{ next_case_study.url | relative_url | escape }}" class="btn btn--full">{{ next_case_study.title | escape }}</a></p>
18+
{% endif %}
619

7-
<p style="text-align: center;"><small><a href="/case-studies/">View all case studies…</a></small></p>
20+
<p style="text-align: center;"><small><a href="{{ '/case-studies/' | relative_url | escape }}">View all case studies…</a></small></p>
821

922
</article>
10-
11-
<script type="application/ld+json">
12-
{
13-
"@context": "https://schema.org",
14-
"@type": "BlogPosting",
15-
"mainEntityOfPage": {
16-
"@type": "WebPage",
17-
"@id": "https://csswizardry.com{{ page.permalink }}"
18-
},
19-
"headline": "{{ page.title }}",
20-
"description": "{{ page.meta }}",
21-
"author": {
22-
"@type": "Person",
23-
"name": "Harry Roberts",
24-
"url": "https://csswizardry.com/about/"
25-
},
26-
"publisher": {
27-
"@type": "Organization",
28-
"name": "CSS Wizardry Ltd",
29-
"logo": {
30-
"@type": "ImageObject",
31-
"url": "https://csswizardry.com/img/csswizardry-logo.png"
32-
}
33-
},
34-
"articleSection": "Case Study"
35-
}
36-
</script>
37-
38-
<script type="application/ld+json">
39-
{
40-
"@context": "https://schema.org",
41-
"@type": "BreadcrumbList",
42-
"itemListElement": [
43-
{
44-
"@type": "ListItem",
45-
"position": 1,
46-
"name": "Home",
47-
"item": "https://csswizardry.com/"
48-
},
49-
{
50-
"@type": "ListItem",
51-
"position": 2,
52-
"name": "Case Studies",
53-
"item": "https://csswizardry.com/case-studies/"
54-
},
55-
{
56-
"@type": "ListItem",
57-
"position": 3,
58-
"name": "{{ page.title }}",
59-
"item": "https://csswizardry.com{{ page.permalink }}"
60-
}
61-
]
62-
}
63-
</script>

‎_layouts/case-study.html‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: post
3+
---
4+
5+
{{ content }}
6+
7+
<hr>
8+
9+
{% include promo-next.html %}
10+
{% include case-study-rich-data.html %}

‎case-studies.md‎

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,11 @@ page-class: page--case-studies
55
permalink: /case-studies/
66
meta: "Real-world performance wins: how I drove gains for ISO.org, Cloudinary, the BBC, and more."
77
lux: "Case Studies"
8-
case_studies:
9-
- title: "ISO.org"
10-
url: "/case-studies/iso-org/"
11-
bg_color: "#e30010"
12-
description: "Performance Audit"
13-
- title: "Cloudinary"
14-
url: "/case-studies/cloudinary/"
15-
bg_color: "#3447c5"
16-
description: "Consultancy"
17-
- title: "Raspberry Pi & Code Club"
18-
url: "/case-studies/raspberry-pi-code-club-workshop/"
19-
bg_gradient: "linear-gradient(to bottom right, #c7053d 0%, #c7053d 50%, #393 50%, #393 100%)"
20-
description: "Workshop"
21-
- title: "Ocado"
22-
url: "/case-studies/ocado-workshop/"
23-
bg_color: "#a9ae00"
24-
description: "Workshop"
25-
- title: "NHS"
26-
url: "/case-studies/nhs-nhsx-elearning-platform/"
27-
bg_color: "#0072c6"
28-
description: "Development, Product, Performance"
29-
- title: "Better Collective"
30-
url: "/case-studies/better-collective/"
31-
bg_color: "#00a767"
32-
description: "Workshop, Consultancy"
33-
- title: "Madgex"
34-
url: "/case-studies/madgex-consultancy-workshop/"
35-
bg_color: "#009ddc"
36-
description: "Workshop, Consultancy"
37-
- title: "BBC"
38-
url: "/case-studies/bbc-workshop/"
39-
bg_color: "#ffdf43"
40-
title_color: "#000"
41-
description: "Workshop, Consultancy"
42-
- title: "BSkyB"
43-
url: "/case-studies/bskyb/"
44-
bg_color: "#01519c"
45-
description: "Development, Product, Workshop"
46-
- title: "CSS Wizardry"
47-
url: "/case-studies/css-wizardry/"
48-
bg_color: "#f43059"
49-
description: "Development, Product"
50-
- title: "Financial Times"
51-
url: "/case-studies/financial-times/"
52-
bg_color: "#fff1e0"
53-
title_color: "#010b13"
54-
description: "Workshop, Consultancy"
8+
regenerate: true
559
---
5610

11+
{% include case-studies.html %}
12+
5713
## Selected Work
5814

5915
<div class="layout">
@@ -76,10 +32,10 @@ case_studies:
7632
</style>
7733

7834
<ul class="feature-list" id="jsCaseStudiesList">
79-
{% for case_study in page.case_studies %}
35+
{% for case_study in case_studies %}
8036
<li class="feature-list__item">
8137
<a
82-
href="{{ case_study.url }}"
38+
href="{{ case_study.url | relative_url | escape }}"
8339
class="feature-list__link"
8440
style="
8541
{% if case_study.bg_color %}background-color: {{ case_study.bg_color }};{% endif %}
@@ -92,8 +48,8 @@ case_studies:
9248
style="color: {{ case_study.title_color }};"
9349
{% endif %}
9450
>
95-
{{ case_study.title }}
96-
<span class="feature-list__sub">{{ case_study.description }}</span>
51+
{{ case_study.client | escape }}
52+
<span class="feature-list__sub">{{ case_study.services | escape }}</span>
9753
</h2>
9854
</a>
9955
</li>
@@ -120,12 +76,12 @@ case_studies:
12076
"@context": "https://schema.org",
12177
"@type": "ItemList",
12278
"itemListElement": [
123-
{% for case_study in page.case_studies %}
79+
{% for case_study in case_studies %}
12480
{
12581
"@type": "ListItem",
12682
"position": {{ forloop.index }},
127-
"url": "{{ case_study.url | absolute_url }}",
128-
"name": "{{ case_study.title }}"
83+
"url": {{ case_study.url | absolute_url | jsonify }},
84+
"name": {{ case_study.client | jsonify }}
12985
}{% if forloop.last == false %},{% endif %}
13086
{% endfor %}
13187
]

‎case-studies/bbc-workshop.md‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
layout: post
32
title: "BBC: Workshop and Code Review"
43
meta: "Running a full-day workshop with developers from the BBC"
54
permalink: /case-studies/bbc-workshop/
6-
next-case-study-title: "Hear about how I changed and improved front-end process for BSkyB."
7-
next-case-study-url: /case-studies/bskyb/
8-
hide-hire-me-link: true
9-
case-study: true
10-
lux: "Case Study"
115
toc: false
6+
client: "BBC"
7+
services: "Workshop, Consultancy"
8+
order: 40
9+
bg_color: "#ffdf43"
10+
title_color: "#000"
1211
---
1312

1413
When Keith Mitchell, Engineering Manager at BBC Sport, emailed me asking if I’d
@@ -61,7 +60,3 @@ review](/services/#section-code-reviews) of sorts.
6160
The day ended with a brief hacking session, experimenting with creating UI
6261
components as discrete packages, and managing them with
6362
[Bower](http://bower.io/).
64-
65-
---
66-
67-
{% include promo-next.html %}

‎case-studies/better-collective.md‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
layout: post
32
title: "Better Collective: Workshops and UI Architecture"
43
meta: "An intensive, week of workshop, hacking, and laying foundations"
54
permalink: /case-studies/better-collective/
6-
next-case-study-title: "How I helped Madgex’s front-end developers get a handle on their UI."
7-
next-case-study-url: /case-studies/madgex-consultancy-workshop/
8-
hide-hire-me-link: true
9-
case-study: true
10-
lux: "Case Study"
115
toc: false
6+
client: "Better Collective"
7+
services: "Workshop, Consultancy"
8+
order: 60
9+
bg_color: "#00a767"
1210
---
1311

1412
At the end of February 2015, I had the immense pleasure of running a week-long
@@ -138,7 +136,3 @@ written, right down to the comments. They’d managed to take a very heavy and
138136
intense week of learning, ask all the right questions, and make it become second
139137
nature. I was incredibly impressed, and cannot wait to check back in again in
140138
six months’ time.
141-
142-
---
143-
144-
{% include promo-next.html %}

‎case-studies/bskyb.md‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
---
2-
layout: post
32
title: "BSkyB: Senior UI Developer"
43
meta: "Almost three years of full-time employment as Senior UI Developer at Sky"
54
permalink: /case-studies/bskyb/
6-
next-case-study-title: "How employing agile techniques helped me be my own client."
7-
next-case-study-url: /case-studies/css-wizardry/
8-
hide-hire-me-link: true
9-
case-study: true
10-
lux: "Case Study"
5+
client: "BSkyB"
6+
services: "Development, Product, Workshop"
7+
order: 30
8+
bg_color: "#01519c"
119
---
1210

1311
For almost three years, I was employed by
@@ -89,7 +87,3 @@ products, be that through direct development and engineering work, through
8987
frameworks and tools I’d written, to code reviews and workshops with other team
9088
members. Working at Sky was an incredible experience, and I’d recommend it to
9189
anyone.
92-
93-
---
94-
95-
{% include promo-next.html %}

0 commit comments

Comments
 (0)